#save WVS longitudinal (waves 1-6) data in working directory.  Here the name WVS_Longitudinal_1981_2014_R_v2015_04_18 is preserved

#save Steven Miller's wvs country code folder in working directory (http://svmiller.com/blog/2015/06/syncing-word-values-survey-country-codes-with-cow-codes/)

load(file="WVS_Longitudinal_1981_2014_R_v2015_04_18.rdata")

wvs<-WVS_Longitudinal_1981_2014_R_v2015_04_18

rm(WVS_Longitudinal_1981_2014_R_v2015_04_18)


library(psych)
library(foreign)
library(countrycode)
library(weights)

#wave is S002

#weight is S017

#country year is S025 (no splits)

#year is of survey is S020

#country is S003
  
#respondent number is S007

#getting labels for country codes, using Steven Miller's files

WVSccodes <- read.csv("wvsccodes-master/wvsccodes-raw.csv")

wvs$wvsccode <- wvs$S003

wvs <- merge(wvs, WVSccodes, by=("wvsccode"), all.x=TRUE)

WVStable <- with(wvs, data.frame(wvsccode, country))
WVStable <- WVStable[!duplicated(wvs[, "wvsccode"]), ]
WVStable$ccode <-  countrycode(WVStable$country, "country.name", "cown")

WVStable$ccode[WVStable$country == "Serbia"] <- 345
WVStable$ccode[WVStable$country == "Serbia and Montenegro"] <- 345
WVStable$ccode[WVStable$country == "Hong Kong"] <- 714
WVStable$ccode[WVStable$country == "Palestine"] <- 667
WVStable$ccode[WVStable$country == "Puerto Rico"] <- 6

# creating western consolidated democracy variable
wvs$westconsoldemoc[!(wvs$S003 %in% c(246, 250, 276, 380, 528, 724, 752, 826, 840, 124, 578, 756, 36, 554))]<-0
wvs$westconsoldemoc[(wvs$S003 %in% c(246, 250, 276, 380, 528, 724, 752, 826, 840, 124, 578, 756, 36, 554))]<-1


#create file of just western consolidated democracies from waves 3-6 called west.  Great Britain's wave 3 data is excluded because many of the items used here were not administered.

west<-subset(wvs, subset=S002>=3&westconsoldemoc==1&!(country=="Great Britain"&S002==3))
rm(wvs)

#output west so can easily access later if necessary
save(west, file="westdata.RData")

#create SOM table b-1, country-wave sample sizes

library(dplyr)
west %>% group_by(country,S002) %>% summarise(n=n()) -> n_west
library(reshape2)
fortableB1<-dcast(data = n_west,country~S002)
library(knitr)

TableB1<-kable(fortableB1,
               format = "pandoc", # default
               digits = 0,        # specify decimal places
               caption = "Table B-1: Country Sample Sizes Across Waves",
               col.names = c("Country", "Wave 3","Wave 4","Wave 5", "Wave 6"),
               row.names = TRUE,
               align = c("c"),   # align = c("c","c","c","r")
               # padding = 2     # inner spacing
)

#variable formation

#wave dummies

west$wave3[west$S002==3]<-1
west$wave4[west$S002==4]<-1
west$wave5[west$S002==5]<-1
west$wave6[west$S002==6]<-1


west$wave3[west$S002!=3]<-0
west$wave4[west$S002!=4]<-0
west$wave5[west$S002!=5]<-0
west$wave6[west$S002!=6]<-0


#DEMOGRAPHICS 


west$sex[west$X001==1]<-0
west$sex[west$X001==2]<-1



west$ageyears<-west$X003
west$ageyears[west$ageyears<0]<-NA

west$collegedegree[west$X025==8]<-1
west$collegedegree[west$X025 %in% c(-3, 1, 2, 3, 4, 5, 6, 7)]<-0



west$hhincdecile<-(west$X047-1)/9
west$hhincdecile[west$hhincdecile<0]<-NA


# CULTURAL CONSERVATISM ITEMS

west$religimp<-1-((west$A006-1)/3)
west$religimp[west$A006<0]<-NA

west$relchild<-west$A040
west$relchild[west$A040<0]<-NA

west$relatt[west$F028==1]<-1
west$relatt[west$F028==2]<-5/6
west$relatt[west$F028==3]<-2/3
west$relatt[west$F028 %in% c(4, 5)]<-.5
west$relatt[west$F028==6]<-1/3
west$relatt[west$F028==7]<-1/6
west$relatt[west$F028==8]<-0


west$religid<-west$F034
west$religid[west$F034 %in% c(2, 3)]<-0
west$religid[west$F034<0]<-NA


west$godimp<-(west$F063-1)/9
west$godimp[west$godimp<0]<-NA



west$indepchildrev[west$A029==1]<-0
west$indepchildrev[west$A029==0]<-1


west$imagchildrev[west$A034==1]<-0
west$imagchildrev[west$A034==0]<-1


west$obedchild[west$A042==0]<-0
west$obedchild[west$A042==1]<-1

west$nototherrace[west$A124_02==0]<-0
west$nototherrace[west$A124_02==1]<-1


west$notimmig[west$A124_06==0]<-0
west$notimmig[west$A124_06==1]<-1



west$menbetterleaders<-1-((west$D059-1)/3)
west$menbetterleaders[west$menbetterleaders>1]<-NA

west$univboy<-1-((west$D060-1)/3)
west$univboy[west$univboy>1]<-NA



west$homosexualitynotok<-1-((west$F118-1)/9)
west$homosexualitynotok[west$homosexualitynotok>1]<-NA

west$abortionnotok<-1-((west$F120-1)/9)
west$abortionnotok[west$abortionnotok>1]<-NA


west$euthannotok<-1-((west$F122-1)/9)
west$euthannotok[west$euthannotok>1]<-NA


west$menrighttojobs[west$C001==1]<-1
west$menrighttojobs[west$C001==2]<-0
west$menrighttojobs[west$C001==3]<-.5

#not in wave 6 
west$immigatt<-(west$E143-1)/3
west$immigatt[west$immigatt<0]<-NA

west$immigjobs[west$C002==1]<-1
west$immigjobs[west$C002==2]<-0
west$immigjobs[west$C002==3]<-.5



#LEFT ECONOMIC ATTITUDE ITEMS

west$incomediffs<-1-((west$E035-1)/9)
west$incomediffs[west$incomediffs>1]<-NA

west$ownershipbusiness<-(west$E036-1)/9
west$ownershipbusiness[west$ownershipbusiness<0]<-NA

west$econresponsibility<-(west$E037-1)/9
west$econresponsibility[west$econresponsibility<0]<-NA

west$competgood<-(west$E039-1)/9
west$competgood[west$competgood<0]<-NA

# this item in waves 3 and 5-6 only
west$hardwork<-(west$E040-1)/9
west$hardwork[west$hardwork<0]<-NA

# this item in waves 3 and 5-6 only
west$wealthpositive<-1-((west$E041-1)/9)
west$wealthpositive[west$wealthpositive>1]<-NA


#CONTROL VARIABLE ITEMS



west$finansat<-(west$C006-1)/9
west$finansat[west$finansat<0]<-NA


west$confparliament<-1-((west$E069_07-1)/3)
west$confparliament[west$confparliament>1]<-NA

west$confgov<-1-((west$E069_11-1)/3)
west$confgov[west$confgov>1]<-NA

west$confparties<-1-((west$E069_12-1)/3)
west$confparties[west$confparties>1]<-NA

west$politimp<-1-((west$A004-1)/3)
west$politimp[west$politimp>1]<-NA

west$politint<-1-((west$E023-1)/3)
west$politint[west$politint>1]<-NA


#OPENNESS TO AUTHORITARIAN GOVERNANCE ITEMS


west$strongleader<-1-((west$E114-1)/3)
west$strongleader[west$strongleader>1]<-NA

west$expertsdecide<-1-((west$E115-1)/3)
west$expertsdecide[west$expertsdecide>1]<-NA

west$armyrule<-1-((west$E116-1)/3)
west$armyrule[west$armyrule>1]<-NA

west$democpolbad<-((west$E117-1)/3)
west$democpolbad[west$democpolbad<0]<-NA


#descriptives and reliability analyses

authgovitemswvs<-subset(west, select=c(strongleader,  armyrule, democpolbad))

psych::alpha(authgovitemswvs)

west$authgov3i<-rowMeans(authgovitemswvs, na.rm=T)

wtd.mean(west$authgov3i, weights=west$S017)

sqrt(wtd.var(west$authgov3i, weights=west$S017))



cultrightitemswvs<-  subset(west, select=c(religimp, relchild, relatt, religid,
                                                       godimp, indepchildrev, imagchildrev, obedchild, nototherrace, notimmig,immigjobs, immigatt, menbetterleaders, univboy, menrighttojobs, homosexualitynotok, abortionnotok, euthannotok))

psych::alpha(cultrightitemswvs)

west$cultright<-rowMeans(cultrightitemswvs, na.rm=T)


wtd.mean(west$cultright, weights=west$S017)

sqrt(wtd.var(west$cultright, weights=west$S017))




econleftitemswvs<-  subset(west, select=c(incomediffs, econresponsibility, ownershipbusiness, competgood, hardwork, wealthpositive))

psych::alpha(econleftitemswvs)

west$econleft<-rowMeans(econleftitemswvs, na.rm=T)

wtd.mean(west$econleft, weights=west$S017)

sqrt(wtd.var(west$econleft, weights=west$S017))



confinstititemswvs<-subset(west, select=c(confparties, confgov, confparliament))

psych::alpha(confinstititemswvs)

west$confinstit<-rowMeans(confinstititemswvs, na.rm=T)

wtd.mean(west$confinstit, weights=west$S017)

sqrt(wtd.var(west$confinstit, weights=west$S017))



polengitemswvs<-subset(west, select=c(politint, politimp))

psych::alpha(polengitemswvs)

west$poleng<-rowMeans(polengitemswvs, na.rm=T)

wtd.mean(west$poleng, weights=west$S017)

sqrt(wtd.var(west$poleng, weights=west$S017))



wtd.mean(west$finansat, weights=west$S017)

sqrt(wtd.var(west$finansat, weights=west$S017))


wtd.mean(west$collegedegree, weights=west$S017)

sqrt(wtd.var(west$collegedegree, weights=west$S017))


wtd.mean(west$ageyears, weights=west$S017)

sqrt(wtd.var(west$ageyears, weights=west$S017))


wtd.mean(west$sex, weights=west$S017)

sqrt(wtd.var(west$sex, weights=west$S017))


wtd.mean(west$hhincdecile, weights=west$S017)

sqrt(wtd.var(west$hhincdecile, weights=west$S017))






#RESULTS



#creation of separate country files, item level imputations, scale formations in copies of each dataset. and analyses and table creation for each countrydataset  

library(mice)
library(miceadds)
library(dplyr)
library(sandwich)
library(texreg)

#create extract.df function for tables
extract.df <- function(tt, cl = NULL) {
  require(sandwich)
  require(mitools)
  require(texreg)
  m2 <- length(tt) 
  betas <- lapply(tt, coef)
  vars <- lapply(tt, FUN = function(x){ vcovCL(x, cluster = cl)})
  model1 <- summary(pool_mi(betas, vars))
  
  R2 <- mean(sapply(1:m2, function(x) summary(tt[[x]])$r.squared))
  ns <- nobs(tt[[1]])
  tr <- createTexreg(
    coef.names = row.names(model1), 
    coef = model1$results, 
    se = model1$se, 
    pvalues = model1$p,
    gof.names = c("R2", "Nobs"), 
    gof = c(R2, ns),
    gof.decimal = c(T,F)
  )
}

#create function to extra CIs based on robust SEs



extract.cis <- function(tt, cl = NULL) {
  require(sandwich)
  require(mitools)
  require(texreg)
  m2 <- length(tt) #number of imputations
  betas <- lapply(tt, coef)
  vars <- lapply(tt, FUN = function(x){ vcovCL(x, cluster = cl)})
  model1 <- summary(pool_mi(betas, vars))
}

#Australia
aus<-subset(west, subset=(country=='Australia'), select=c(religimp, relchild, relatt, religid,
  godimp, indepchildrev, imagchildrev, obedchild, nototherrace, notimmig,immigjobs, immigatt, menbetterleaders, univboy, menrighttojobs, homosexualitynotok, abortionnotok, euthannotok, incomediffs, econresponsibility, ownershipbusiness, competgood, hardwork, wealthpositive, strongleader, armyrule, expertsdecide, democpolbad, sex, ageyears, collegedegree, hhincdecile, confparties, confgov, confparliament, politint, politimp, finansat, S017, wave5, wave6))

ausi<-mice(aus, m=20)

longaus<-complete(ausi, action='long', include=TRUE)

longaus$authgov3i<-  with(longaus, rowMeans(data.frame(strongleader,armyrule, democpolbad)))

longaus$authgov4i<-  with(longaus, rowMeans(data.frame(strongleader,armyrule,expertsdecide,democpolbad)))

longaus$cultright<-  with(longaus, rowMeans(data.frame(religimp, relchild, relatt, religid,
                                                       godimp, indepchildrev, imagchildrev, obedchild, nototherrace, notimmig,immigjobs, immigatt, menbetterleaders, univboy, menrighttojobs, homosexualitynotok, abortionnotok, euthannotok)))


longaus$econleft<-  with(longaus, rowMeans(data.frame(incomediffs, econresponsibility, ownershipbusiness, competgood, hardwork, wealthpositive)))

longaus$age1s<-with(longaus, (ageyears-min(ageyears, na.rm=T))/(max(ageyears, na.rm=T)-min(ageyears, na.rm=T)) )

longaus$confinstit<-with(longaus, rowMeans(data.frame(confparties, confgov, confparliament)))

longaus$poleng<-with(longaus, rowMeans(data.frame(politint, politimp)))


longaus$cultrightplussd<-with(longaus, cultright-(mean(cultright, na.rm=T)+sd(cultright, na.rm=T)))

longaus$cultrightminussd<-with(longaus, cultright-(mean(cultright, na.rm=T)-sd(cultright, na.rm=T)))

longaus$econleftplussd<-with(longaus, econleft-(mean(econleft, na.rm=T)+sd(econleft, na.rm=T)))

longaus$econleftminussd<-with(longaus, econleft-(mean(econleft, na.rm=T)-sd(econleft, na.rm=T)))

longaus$cultrightscl<-with(longaus, (cultright-mean(cultright, na.rm=T))/(2*sd(cultright, na.rm=T)))

longaus$econleftscl<-with(longaus, (econleft-mean(econleft, na.rm=T))/(2*sd(econleft, na.rm=T)))


longaus$age1sscl<-with(longaus, (age1s-mean(age1s, na.rm=T))/(2*sd(age1s, na.rm=T)))


longaus$confinstitscl<-with(longaus, (confinstit-mean(confinstit, na.rm=T))/(2*sd(confinstit, na.rm=T)))


longaus$polengscl<-with(longaus, (poleng-mean(poleng, na.rm=T))/(2*sd(poleng, na.rm=T)))


longaus$hhincdecilescl<-with(longaus, (hhincdecile-mean(hhincdecile, na.rm=T))/(2*sd(hhincdecile, na.rm=T)))


longaus$finansatscl<-with(longaus, (finansat-mean(finansat, na.rm=T))/(2*sd(finansat, na.rm=T)))



ausi2 <- as.mids(longaus)



ausdatlist <- miceadds::mids2datlist(ausi2)

ausreg1<- with(ausdatlist,lm(authgov3i~cultrightscl+econleftscl, weights = S017))


ausreg2<- with(ausdatlist,lm(authgov3i~cultrightscl+econleftscl+cultrightscl:econleftscl, weights = S017))


ausreg3<- with(ausdatlist,lm(authgov3i~cultrightscl+econleftscl+sex+age1sscl+collegedegree+hhincdecilescl+confinstitscl+polengscl+finansatscl, weights = S017))


ausreg4<- with(ausdatlist,lm(authgov3i~cultrightscl+econleftscl+sex+age1sscl+collegedegree+hhincdecilescl+confinstitscl+polengscl+finansatscl+cultrightscl:econleftscl, weights = S017))

ausregright<- with(ausdatlist,lm(authgov3i~cultrightplussd+econleftminussd+cultrightplussd:econleftminussd, weights = S017))

ausregleft<- with(ausdatlist,lm(authgov3i~cultrightminussd+econleftplussd+cultrightminussd:econleftplussd, weights = S017))

ausregprot<- with(ausdatlist,lm(authgov3i~cultrightplussd+econleftplussd+cultrightplussd:econleftplussd, weights = S017))

ausregfree<- with(ausdatlist,lm(authgov3i~cultrightminussd+econleftminussd+cultrightminussd:econleftminussd, weights = S017))





auscultb <- extract.cis(ausreg1)[2,1]
auscultlower <- extract.cis(ausreg1)[2,5]
auscultupper <-extract.cis(ausreg1)[2,6]

auseconb <- extract.cis(ausreg1)[3,1]
auseconlower <- extract.cis(ausreg1)[3,5]
auseconupper <-extract.cis(ausreg1)[3,6]


ausintb <- extract.cis(ausreg2)[4,1]
ausintlower <- extract.cis(ausreg2)[4,5]
ausintupper <-extract.cis(ausreg2)[4,6]

ausrightest<-extract.cis(ausregright)[1,1]
ausrightlower<-extract.cis(ausregright)[1,5]
ausrightupper<-extract.cis(ausregright)[1,6]

ausleftest<-extract.cis(ausregleft)[1,1]
ausleftlower<-extract.cis(ausregleft)[1,5]
ausleftupper<-extract.cis(ausregleft)[1,6]

ausprotest<-extract.cis(ausregprot)[1,1]
ausprotlower<-extract.cis(ausregprot)[1,5]
ausprotupper<-extract.cis(ausregprot)[1,6]

ausfreeest<-extract.cis(ausregfree)[1,1]
ausfreelower<-extract.cis(ausregfree)[1,5]
ausfreeupper<-extract.cis(ausregfree)[1,6]


auscultb3<-extract.cis(ausreg3)[2,1]
auspolengb3<-extract.cis(ausreg3)[9,1]
ausageb3<-extract.cis(ausreg3)[5,1]
auscollegeb3<-extract.cis(ausreg3)[6,1]
ausconfinstitb3<-extract.cis(ausreg3)[8,1]


ausout1 <- extract.df(ausreg1)
ausout2 <- extract.df(ausreg2)
ausout3 <- extract.df(ausreg3)
ausout4 <- extract.df(ausreg4)

htmlreg(list(ausout1,ausout2,ausout3,ausout4), digits = 3, file = "AustraliaWVS.table.html",custom.coef.names = c("Constant","Cultural Conservatism","Left Economic Attitudes","Cultural Conservatism x Left Economic Attitudes","Female","Age","College Degree","Household Income", "Confidence in Institutions","Political Engagement","Financial Satisfaction"),caption.above = T,caption = "Table D-1: Predictors of Openness to Authoritarain Governance in Australia WVS Dataset",custom.note = ("%stars. <br> Continuous predictors are mean-centered and scaled by two standard deviations. Binary predictors are coded 0-1.<br>The outcome variable is coded to range from 0.0 to 1.0<br> Missing data were replaced using multiple imputation with results pooled across 20 copies of the dataset."),custom.gof.names = c("R<sup>2</sup>","Observations"))

ausreg5<- with(ausdatlist,lm(authgov3i~cultrightscl+econleftscl+sex+age1sscl+collegedegree+hhincdecilescl+confinstitscl+finansatscl+cultrightscl:econleftscl, weights = S017))

ausout5<-extract.df(ausreg5)

#Canada
  
can<-subset(west, subset=(country=='Canada'), select=c(religimp, relchild, relatt, religid,
                                                          godimp, indepchildrev, imagchildrev, obedchild, nototherrace, notimmig,immigjobs, immigatt, menbetterleaders, univboy, menrighttojobs, homosexualitynotok, abortionnotok, euthannotok, incomediffs, econresponsibility, ownershipbusiness, competgood, hardwork, wealthpositive, strongleader, armyrule, expertsdecide, democpolbad, sex, ageyears, collegedegree, hhincdecile, confparties, confgov, confparliament, politint, politimp, finansat, S017, wave5))


cani<-mice(can, m=20)

longcan <- complete(cani, action='long', include=TRUE)

longcan$authgov4i<-  with(longcan, rowMeans(data.frame(strongleader,armyrule,expertsdecide,democpolbad)))

longcan$authgov3i<-  with(longcan, rowMeans(data.frame(strongleader,armyrule,democpolbad)))

longcan$cultright<-  with(longcan, rowMeans(data.frame(religimp, relchild, relatt, religid,
                                                       godimp, indepchildrev, imagchildrev, obedchild, nototherrace, notimmig,immigjobs, immigatt, menbetterleaders, univboy, menrighttojobs, homosexualitynotok, abortionnotok, euthannotok)))


longcan$econleft<-  with(longcan, rowMeans(data.frame(incomediffs, econresponsibility, ownershipbusiness, competgood, hardwork, wealthpositive)))

longcan$age1s<-with(longcan, (ageyears-min(ageyears, na.rm=T))/(max(ageyears, na.rm=T)-min(ageyears, na.rm=T)) )

longcan$confinstit<-with(longcan, rowMeans(data.frame(confparties, confgov, confparliament)))

longcan$poleng<-with(longcan, rowMeans(data.frame(politint, politimp)))


longcan$cultrightplussd<-with(longcan, cultright-(mean(cultright, na.rm=T)+sd(cultright, na.rm=T)))

longcan$cultrightminussd<-with(longcan, cultright-(mean(cultright, na.rm=T)-sd(cultright, na.rm=T)))

longcan$econleftplussd<-with(longcan, econleft-(mean(econleft, na.rm=T)+sd(econleft, na.rm=T)))

longcan$econleftminussd<-with(longcan, econleft-(mean(econleft, na.rm=T)-sd(econleft, na.rm=T)))

longcan$cultrightscl<-with(longcan, (cultright-mean(cultright, na.rm=T))/(2*sd(cultright, na.rm=T)))

longcan$econleftscl<-with(longcan, (econleft-mean(econleft, na.rm=T))/(2*sd(econleft, na.rm=T)))


longcan$age1sscl<-with(longcan, (age1s-mean(age1s, na.rm=T))/(2*sd(age1s, na.rm=T)))


longcan$confinstitscl<-with(longcan, (confinstit-mean(confinstit, na.rm=T))/(2*sd(confinstit, na.rm=T)))


longcan$polengscl<-with(longcan, (poleng-mean(poleng, na.rm=T))/(2*sd(poleng, na.rm=T)))


longcan$hhincdecilescl<-with(longcan, (hhincdecile-mean(hhincdecile, na.rm=T))/(2*sd(hhincdecile, na.rm=T)))


longcan$finansatscl<-with(longcan, (finansat-mean(finansat, na.rm=T))/(2*sd(finansat, na.rm=T)))


longcan$econextrem<-abs(with(longcan, (econleft-mean(econleft, na.rm=T))))

longcan$econextremscl<-with(longcan, (econextrem-mean(econextrem, na.rm=T))/(2*sd(econextrem, na.rm=T)))

cani2 <- as.mids(longcan)

candatlist <- miceadds::mids2datlist(cani2)

canreg1<- with(candatlist,lm(authgov3i~cultrightscl+econleftscl, weights = S017))

canreg2<- with(candatlist,lm(authgov3i~cultrightscl+econleftscl+cultrightscl:econleftscl, weights = S017))


canreg3<- with(candatlist,lm(authgov3i~cultrightscl+econleftscl+sex+age1sscl+collegedegree+hhincdecilescl+confinstitscl+polengscl+finansatscl, weights = S017))


canreg4<- with(candatlist,lm(authgov3i~cultrightscl+econleftscl+sex+age1sscl+collegedegree+hhincdecilescl+confinstitscl+polengscl+finansatscl+cultrightscl:econleftscl, weights = S017))



canregright<- with(candatlist,lm(authgov3i~cultrightplussd+econleftminussd+cultrightplussd:econleftminussd, weights = S017))


canregleft<- with(candatlist,lm(authgov3i~cultrightminussd+econleftplussd+cultrightminussd:econleftplussd, weights = S017))

canregprot<- with(candatlist,lm(authgov3i~cultrightplussd+econleftplussd+cultrightplussd:econleftplussd, weights = S017))

canregfree<- with(candatlist,lm(authgov3i~cultrightminussd+econleftminussd+cultrightminussd:econleftminussd, weights = S017))





cancultb <- extract.cis(canreg1)[2,1]
cancultlower <- extract.cis(canreg1)[2,5]
cancultupper <-extract.cis(canreg1)[2,6]

caneconb <- extract.cis(canreg1)[3,1]
caneconlower <- extract.cis(canreg1)[3,5]
caneconupper <-extract.cis(canreg1)[3,6]


canintb <- extract.cis(canreg2)[4,1]
canintlower <- extract.cis(canreg2)[4,5]
canintupper <-extract.cis(canreg2)[4,6]

canrightest<-extract.cis(canregright)[1,1]
canrightlower<-extract.cis(canregright)[1,5]
canrightupper<-extract.cis(canregright)[1,6]

canleftest<-extract.cis(canregleft)[1,1]
canleftlower<-extract.cis(canregleft)[1,5]
canleftupper<-extract.cis(canregleft)[1,6]

canprotest<-extract.cis(canregprot)[1,1]
canprotlower<-extract.cis(canregprot)[1,5]
canprotupper<-extract.cis(canregprot)[1,6]

canfreeest<-extract.cis(canregfree)[1,1]
canfreelower<-extract.cis(canregfree)[1,5]
canfreeupper<-extract.cis(canregfree)[1,6]


cancultb3<-extract.cis(canreg3)[2,1]
canpolengb3<-extract.cis(canreg3)[9,1]
canageb3<-extract.cis(canreg3)[5,1]
cancollegeb3<-extract.cis(canreg3)[6,1]
canconfinstitb3<-extract.cis(canreg3)[8,1]



canout1 <- extract.df(canreg1)
canout2 <- extract.df(canreg2)
canout3 <- extract.df(canreg3)
canout4 <- extract.df(canreg4)


htmlreg(list(canout1,canout2,canout3,canout4), digits = 3,file = "CanadaWVS.table.html",custom.coef.names = c("Constant","Cultural Conservatism","Left Economic Attitudes","Cultural Conservatism x Left Economic Attitudes","Female","Age","College Degree","Household Income", "Confidence in Institutions","Political Engagement","Financial Satisfaction"),caption.above = T,caption = "Table D-2: Predictors of Openness to Authoritarain Governance in Canada WVS Dataset",custom.note = ("%stars. <br> Continuous predictors are mean-centered and scaled by two standard deviations. Binary predictors are coded 0-1.<br>The outcome variable is coded to range from 0.0 to 1.0  <br> Missing data were replaced using multiple imputation with results pooled across 20 copies of the dataset."),custom.gof.names = c("R<sup>2</sup>","Observations"))




#Finland

fin<-subset(west, subset=(country=='Finland'), select=c(religimp, relchild, relatt, religid,
                                                       godimp, indepchildrev, imagchildrev, obedchild, nototherrace, notimmig,immigjobs, immigatt, menbetterleaders, univboy, menrighttojobs, homosexualitynotok, abortionnotok, euthannotok, incomediffs, econresponsibility, ownershipbusiness, competgood, hardwork, wealthpositive, strongleader, armyrule, expertsdecide, democpolbad, sex, ageyears, collegedegree, hhincdecile, confparties, confgov, confparliament, politint, politimp, finansat, S017, wave5))


fini<-mice(fin, m=20)

longfin <- complete(fini, action='long', include=TRUE)

longfin$authgov4i<-  with(longfin, rowMeans(data.frame(strongleader,armyrule,expertsdecide,democpolbad)))

longfin$authgov3i<-  with(longfin, rowMeans(data.frame(strongleader,armyrule,democpolbad)))

longfin$cultright<-  with(longfin, rowMeans(data.frame(religimp, relchild, relatt, religid,
                                                       godimp, indepchildrev, imagchildrev, obedchild, nototherrace, notimmig,immigjobs, immigatt, menbetterleaders, univboy, menrighttojobs, homosexualitynotok, abortionnotok, euthannotok)))


longfin$econleft<-  with(longfin, rowMeans(data.frame(incomediffs, econresponsibility, ownershipbusiness, competgood, hardwork, wealthpositive)))

longfin$age1s<-with(longfin, (ageyears-min(ageyears, na.rm=T))/(max(ageyears, na.rm=T)-min(ageyears, na.rm=T)) )

longfin$confinstit<-with(longfin, rowMeans(data.frame(confparties, confgov, confparliament)))

longfin$poleng<-with(longfin, rowMeans(data.frame(politint, politimp)))


longfin$cultrightplussd<-with(longfin, cultright-(mean(cultright, na.rm=T)+sd(cultright, na.rm=T)))

longfin$cultrightminussd<-with(longfin, cultright-(mean(cultright, na.rm=T)-sd(cultright, na.rm=T)))

longfin$econleftplussd<-with(longfin, econleft-(mean(econleft, na.rm=T)+sd(econleft, na.rm=T)))

longfin$econleftminussd<-with(longfin, econleft-(mean(econleft, na.rm=T)-sd(econleft, na.rm=T)))


longfin$cultrightscl<-with(longfin, (cultright-mean(cultright, na.rm=T))/(2*sd(cultright, na.rm=T)))

longfin$econleftscl<-with(longfin, (econleft-mean(econleft, na.rm=T))/(2*sd(econleft, na.rm=T)))


longfin$age1sscl<-with(longfin, (age1s-mean(age1s, na.rm=T))/(2*sd(age1s, na.rm=T)))


longfin$confinstitscl<-with(longfin, (confinstit-mean(confinstit, na.rm=T))/(2*sd(confinstit, na.rm=T)))


longfin$polengscl<-with(longfin, (poleng-mean(poleng, na.rm=T))/(2*sd(poleng, na.rm=T)))


longfin$hhincdecilescl<-with(longfin, (hhincdecile-mean(hhincdecile, na.rm=T))/(2*sd(hhincdecile, na.rm=T)))


longfin$finansatscl<-with(longfin, (finansat-mean(finansat, na.rm=T))/(2*sd(finansat, na.rm=T)))

longfin$econextrem<-abs(with(longfin, (econleft-mean(econleft, na.rm=T))))

longfin$econextremscl<-with(longfin, (econextrem-mean(econextrem, na.rm=T))/(2*sd(econextrem, na.rm=T)))


fini2 <- as.mids(longfin)

findatlist <- miceadds::mids2datlist(fini2)

finreg1<- with(findatlist,lm(authgov3i~cultrightscl+econleftscl, weights = S017))

finreg2<- with(findatlist,lm(authgov3i~cultrightscl+econleftscl+cultrightscl:econleftscl, weights = S017))


finreg3<- with(findatlist,lm(authgov3i~cultrightscl+econleftscl+sex+age1sscl+collegedegree+hhincdecilescl+confinstitscl+polengscl+finansatscl, weights = S017))


finreg4<- with(findatlist,lm(authgov3i~cultrightscl+econleftscl+sex+age1sscl+collegedegree+hhincdecilescl+confinstitscl+polengscl+finansatscl+cultrightscl:econleftscl, weights = S017))



finregright<- with(findatlist,lm(authgov3i~cultrightplussd+econleftminussd+cultrightplussd:econleftminussd, weights = S017))


finregleft<- with(findatlist,lm(authgov3i~cultrightminussd+econleftplussd+cultrightminussd:econleftplussd, weights = S017))


finregprot<- with(findatlist,lm(authgov3i~cultrightplussd+econleftplussd+cultrightplussd:econleftplussd, weights = S017))


finregfree<- with(findatlist,lm(authgov3i~cultrightminussd+econleftminussd+cultrightminussd:econleftminussd, weights = S017))





fincultb <- extract.cis(finreg1)[2,1]
fincultlower <- extract.cis(finreg1)[2,5]
fincultupper <-extract.cis(finreg1)[2,6]

fineconb <- extract.cis(finreg1)[3,1]
fineconlower <- extract.cis(finreg1)[3,5]
fineconupper <-extract.cis(finreg1)[3,6]


finintb <- extract.cis(finreg2)[4,1]
finintlower <- extract.cis(finreg2)[4,5]
finintupper <-extract.cis(finreg2)[4,6]

finrightest<-extract.cis(finregright)[1,1]
finrightlower<-extract.cis(finregright)[1,5]
finrightupper<-extract.cis(finregright)[1,6]

finleftest<-extract.cis(finregleft)[1,1]
finleftlower<-extract.cis(finregleft)[1,5]
finleftupper<-extract.cis(finregleft)[1,6]

finprotest<-extract.cis(finregprot)[1,1]
finprotlower<-extract.cis(finregprot)[1,5]
finprotupper<-extract.cis(finregprot)[1,6]

finfreeest<-extract.cis(finregfree)[1,1]
finfreelower<-extract.cis(finregfree)[1,5]
finfreeupper<-extract.cis(finregfree)[1,6]


fincultb3<-extract.cis(finreg3)[2,1]
finpolengb3<-extract.cis(finreg3)[9,1]
finageb3<-extract.cis(finreg3)[5,1]
fincollegeb3<-extract.cis(finreg3)[6,1]
finconfinstitb3<-extract.cis(finreg3)[8,1]




finout1 <- extract.df(finreg1)
finout2 <- extract.df(finreg2)
finout3 <- extract.df(finreg3)
finout4 <- extract.df(finreg4)


htmlreg(list(finout1,finout2,finout3,finout4), digits = 3,file = "FinlandWVS.table.html",custom.coef.names = c("Constant","Cultural Conservatism","Left Economic Attitudes","Cultural Conservatism x Left Economic Attitudes","Female","Age","College Degree","Household Income", "Confidence in Institutions","Political Engagement","Financial Satisfaction"),caption.above = T,caption = "Table D-3: Predictors of Openness to Authoritarain Governance in Finland WVS Dataset",custom.note = ("%stars. <br> Continuous predictors are mean-centered and scaled by two standard deviations. Binary predictors are coded 0-1.<br>The outcome variable is coded to range from 0.0 to 1.0<br> Missing data were replaced using multiple imputation with results pooled across 20 copies of the dataset."),custom.gof.names = c("R<sup>2</sup>","Observations"))









#France

fra<-subset(west, subset=(country=='France'), select=c(religimp, relchild, relatt, religid,
                                                       godimp, indepchildrev, imagchildrev, obedchild, nototherrace, notimmig,immigjobs, immigatt, menbetterleaders, univboy, menrighttojobs, homosexualitynotok, abortionnotok, euthannotok, incomediffs, econresponsibility, ownershipbusiness, competgood, hardwork, wealthpositive, strongleader, armyrule, expertsdecide, democpolbad, sex, ageyears, collegedegree, hhincdecile, confparties, confgov, confparliament, politint, politimp, finansat, S017))


frai<-mice(fra, m=20)

longfra <- complete(frai, action='long', include=TRUE)

longfra$authgov4i<-  with(longfra, rowMeans(data.frame(strongleader,armyrule,expertsdecide,democpolbad)))


longfra$authgov3i<-  with(longfra, rowMeans(data.frame(strongleader,armyrule,democpolbad)))

longfra$cultright<-  with(longfra, rowMeans(data.frame(religimp, relchild, relatt, religid,                                                      godimp, indepchildrev, imagchildrev, obedchild, nototherrace, notimmig,immigjobs, menbetterleaders, univboy, menrighttojobs, homosexualitynotok, abortionnotok, euthannotok)))


longfra$econleft<-  with(longfra, rowMeans(data.frame(incomediffs, econresponsibility, competgood, hardwork, wealthpositive)))

longfra$age1s<-with(longfra, (ageyears-min(ageyears, na.rm=T))/(max(ageyears, na.rm=T)-min(ageyears, na.rm=T)) )

longfra$confinstit<-with(longfra, rowMeans(data.frame(confparties, confgov, confparliament)))

longfra$poleng<-with(longfra, rowMeans(data.frame(politint, politimp)))


longfra$cultrightplussd<-with(longfra, cultright-(mean(cultright, na.rm=T)+sd(cultright, na.rm=T)))

longfra$cultrightminussd<-with(longfra, cultright-(mean(cultright, na.rm=T)-sd(cultright, na.rm=T)))

longfra$econleftplussd<-with(longfra, econleft-(mean(econleft, na.rm=T)+sd(econleft, na.rm=T)))

longfra$econleftminussd<-with(longfra, econleft-(mean(econleft, na.rm=T)-sd(econleft, na.rm=T)))


longfra$cultrightscl<-with(longfra, (cultright-mean(cultright, na.rm=T))/(2*sd(cultright, na.rm=T)))

longfra$econleftscl<-with(longfra, (econleft-mean(econleft, na.rm=T))/(2*sd(econleft, na.rm=T)))


longfra$age1sscl<-with(longfra, (age1s-mean(age1s, na.rm=T))/(2*sd(age1s, na.rm=T)))


longfra$confinstitscl<-with(longfra, (confinstit-mean(confinstit, na.rm=T))/(2*sd(confinstit, na.rm=T)))


longfra$polengscl<-with(longfra, (poleng-mean(poleng, na.rm=T))/(2*sd(poleng, na.rm=T)))


longfra$hhincdecilescl<-with(longfra, (hhincdecile-mean(hhincdecile, na.rm=T))/(2*sd(hhincdecile, na.rm=T)))


longfra$finansatscl<-with(longfra, (finansat-mean(finansat, na.rm=T))/(2*sd(finansat, na.rm=T)))

longfra$econextrem<-abs(with(longfra, (econleft-mean(econleft, na.rm=T))))

longfra$econextremscl<-with(longfra, (econextrem-mean(econextrem, na.rm=T))/(2*sd(econextrem, na.rm=T)))


frai2 <- as.mids(longfra)

fradatlist <- miceadds::mids2datlist(frai2)

frareg1<- with(fradatlist,lm(authgov3i~cultrightscl+econleftscl, weights = S017))

frareg2<- with(fradatlist,lm(authgov3i~cultrightscl+econleftscl+cultrightscl:econleftscl, weights = S017))


frareg3<- with(fradatlist,lm(authgov3i~cultrightscl+econleftscl+sex+age1sscl+collegedegree+hhincdecilescl+confinstitscl+polengscl+finansatscl, weights = S017))


frareg4<- with(fradatlist,lm(authgov3i~cultrightscl+econleftscl+sex+age1sscl+collegedegree+hhincdecilescl+confinstitscl+polengscl+finansatscl+cultrightscl:econleftscl, weights = S017))




fraregright<- with(fradatlist,lm(authgov3i~cultrightplussd+econleftminussd+cultrightplussd:econleftminussd, weights = S017))


fraregleft<- with(fradatlist,lm(authgov3i~cultrightminussd+econleftplussd+cultrightminussd:econleftplussd, weights = S017))


fraregprot<- with(fradatlist,lm(authgov3i~cultrightplussd+econleftplussd+cultrightplussd:econleftplussd, weights = S017))


fraregfree<- with(fradatlist,lm(authgov3i~cultrightminussd+econleftminussd+cultrightminussd:econleftminussd, weights = S017))



fracultb <- extract.cis(frareg1)[2,1]
fracultlower <- extract.cis(frareg1)[2,5]
fracultupper <-extract.cis(frareg1)[2,6]

fraeconb <- extract.cis(frareg1)[3,1]
fraeconlower <- extract.cis(frareg1)[3,5]
fraeconupper <-extract.cis(frareg1)[3,6]


fraintb <- extract.cis(frareg2)[4,1]
fraintlower <- extract.cis(frareg2)[4,5]
fraintupper <-extract.cis(frareg2)[4,6]

frarightest<-extract.cis(fraregright)[1,1]
frarightlower<-extract.cis(fraregright)[1,5]
frarightupper<-extract.cis(fraregright)[1,6]

fraleftest<-extract.cis(fraregleft)[1,1]
fraleftlower<-extract.cis(fraregleft)[1,5]
fraleftupper<-extract.cis(fraregleft)[1,6]

fraprotest<-extract.cis(fraregprot)[1,1]
fraprotlower<-extract.cis(fraregprot)[1,5]
fraprotupper<-extract.cis(fraregprot)[1,6]

frafreeest<-extract.cis(fraregfree)[1,1]
frafreelower<-extract.cis(fraregfree)[1,5]
frafreeupper<-extract.cis(fraregfree)[1,6]


fracultb3<-extract.cis(frareg3)[2,1]
frapolengb3<-extract.cis(frareg3)[9,1]
fraageb3<-extract.cis(frareg3)[5,1]
fracollegeb3<-extract.cis(frareg3)[6,1]
fraconfinstitb3<-extract.cis(frareg3)[8,1]



fraout1 <- extract.df(frareg1)
fraout2 <- extract.df(frareg2)
fraout3 <- extract.df(frareg3)
fraout4 <- extract.df(frareg4)


htmlreg(list(fraout1,fraout2,fraout3,fraout4), digits = 3,file = "FranceWVS.table.html",custom.coef.names = c("Constant","Cultural Conservatism","Left Economic Attitudes","Cultural Conservatism x Left Economic Attitudes","Female","Age","College Degree","Household Income", "Confidence in Institutions","Political Engagement","Financial Satisfaction"),caption.above = T,caption = "Table D-4: Predictors of Openness to Authoritarain Governance in France WVS Dataset",custom.note = ("%stars. <br> Continuous predictors are mean-centered and scaled by two standard deviations. Binary predictors are coded 0-1.<br>The outcome variable is coded to range from 0.0 to 1.0 <br> Missing data were replaced using multiple imputation with results pooled across 20 copies of the dataset."),custom.gof.names = c("R<sup>2</sup>","Observations"))







#Germany

ger<-subset(west, subset=(country=='Germany'), select=c(religimp, relchild, relatt, religid, godimp, indepchildrev, imagchildrev, obedchild, nototherrace, notimmig,immigjobs, immigatt, menbetterleaders, univboy, menrighttojobs, homosexualitynotok, abortionnotok, euthannotok, incomediffs, econresponsibility, ownershipbusiness, competgood, hardwork, wealthpositive, strongleader, armyrule, expertsdecide, democpolbad, sex, ageyears, collegedegree, hhincdecile, confparties, confgov, confparliament, politint, politimp, finansat, S017, wave5, wave6))


geri<-mice(ger, m=20)

longger <- complete(geri, action='long', include=TRUE)

longger$authgov4i<-  with(longger, rowMeans(data.frame(strongleader,armyrule,expertsdecide,democpolbad)))


longger$authgov3i<-  with(longger, rowMeans(data.frame(strongleader,armyrule,democpolbad)))


longger$cultright<-  with(longger, rowMeans(data.frame(religimp, relchild, relatt, religid,
                                                       godimp, indepchildrev, imagchildrev, obedchild, nototherrace, notimmig,immigjobs, immigatt, menbetterleaders, univboy, menrighttojobs, homosexualitynotok, abortionnotok, euthannotok)))


longger$econleft<-  with(longger, rowMeans(data.frame(incomediffs, econresponsibility, ownershipbusiness, competgood, hardwork, wealthpositive)))

longger$age1s<-with(longger, (ageyears-min(ageyears, na.rm=T))/(max(ageyears, na.rm=T)-min(ageyears, na.rm=T)) )

longger$confinstit<-with(longger, rowMeans(data.frame(confparties, confgov, confparliament)))

longger$poleng<-with(longger, rowMeans(data.frame(politint, politimp)))


longger$cultrightplussd<-with(longger, cultright-(mean(cultright, na.rm=T)+sd(cultright, na.rm=T)))

longger$cultrightminussd<-with(longger, cultright-(mean(cultright, na.rm=T)-sd(cultright, na.rm=T)))

longger$econleftplussd<-with(longger, econleft-(mean(econleft, na.rm=T)+sd(econleft, na.rm=T)))

longger$econleftminussd<-with(longger, econleft-(mean(econleft, na.rm=T)-sd(econleft, na.rm=T)))


longger$cultrightscl<-with(longger, (cultright-mean(cultright, na.rm=T))/(2*sd(cultright, na.rm=T)))

longger$econleftscl<-with(longger, (econleft-mean(econleft, na.rm=T))/(2*sd(econleft, na.rm=T)))


longger$age1sscl<-with(longger, (age1s-mean(age1s, na.rm=T))/(2*sd(age1s, na.rm=T)))


longger$confinstitscl<-with(longger, (confinstit-mean(confinstit, na.rm=T))/(2*sd(confinstit, na.rm=T)))


longger$polengscl<-with(longger, (poleng-mean(poleng, na.rm=T))/(2*sd(poleng, na.rm=T)))


longger$hhincdecilescl<-with(longger, (hhincdecile-mean(hhincdecile, na.rm=T))/(2*sd(hhincdecile, na.rm=T)))


longger$finansatscl<-with(longger, (finansat-mean(finansat, na.rm=T))/(2*sd(finansat, na.rm=T)))

longger$econextrem<-abs(with(longger, (econleft-mean(econleft, na.rm=T))))

longger$econextremscl<-with(longger, (econextrem-mean(econextrem, na.rm=T))/(2*sd(econextrem, na.rm=T)))


geri2 <- as.mids(longger)

gerdatlist <- miceadds::mids2datlist(geri2)

gerreg1<- with(gerdatlist,lm(authgov3i~cultrightscl+econleftscl, weights = S017))

gerreg2<- with(gerdatlist,lm(authgov3i~cultrightscl+econleftscl+cultrightscl:econleftscl, weights = S017))


gerreg3<- with(gerdatlist,lm(authgov3i~cultrightscl+econleftscl+sex+age1sscl+collegedegree+hhincdecilescl+confinstitscl+polengscl+finansatscl, weights = S017))


gerreg4<- with(gerdatlist,lm(authgov3i~cultrightscl+econleftscl+sex+age1sscl+collegedegree+hhincdecilescl+confinstitscl+polengscl+finansatscl+cultrightscl:econleftscl, weights = S017))





gerregright<- with(gerdatlist,lm(authgov3i~cultrightplussd+econleftminussd+cultrightplussd:econleftminussd, weights = S017))


gerregleft<- with(gerdatlist,lm(authgov3i~cultrightminussd+econleftplussd+cultrightminussd:econleftplussd, weights = S017))


gerregprot<- with(gerdatlist,lm(authgov3i~cultrightplussd+econleftplussd+cultrightplussd:econleftplussd, weights = S017))


gerregfree<- with(gerdatlist,lm(authgov3i~cultrightminussd+econleftminussd+cultrightminussd:econleftminussd, weights = S017))




gercultb <- extract.cis(gerreg1)[2,1]
gercultlower <- extract.cis(gerreg1)[2,5]
gercultupper <-extract.cis(gerreg1)[2,6]

gereconb <- extract.cis(gerreg1)[3,1]
gereconlower <- extract.cis(gerreg1)[3,5]
gereconupper <-extract.cis(gerreg1)[3,6]


gerintb <- extract.cis(gerreg2)[4,1]
gerintlower <- extract.cis(gerreg2)[4,5]
gerintupper <-extract.cis(gerreg2)[4,6]

gerrightest<-extract.cis(gerregright)[1,1]
gerrightlower<-extract.cis(gerregright)[1,5]
gerrightupper<-extract.cis(gerregright)[1,6]

gerleftest<-extract.cis(gerregleft)[1,1]
gerleftlower<-extract.cis(gerregleft)[1,5]
gerleftupper<-extract.cis(gerregleft)[1,6]

gerprotest<-extract.cis(gerregprot)[1,1]
gerprotlower<-extract.cis(gerregprot)[1,5]
gerprotupper<-extract.cis(gerregprot)[1,6]

gerfreeest<-extract.cis(gerregfree)[1,1]
gerfreelower<-extract.cis(gerregfree)[1,5]
gerfreeupper<-extract.cis(gerregfree)[1,6]


gercultb3<-extract.cis(gerreg3)[2,1]
gerpolengb3<-extract.cis(gerreg3)[9,1]
gerageb3<-extract.cis(gerreg3)[5,1]
gercollegeb3<-extract.cis(gerreg3)[6,1]
gerconfinstitb3<-extract.cis(gerreg3)[8,1]



gerout1 <- extract.df(gerreg1)
gerout2 <- extract.df(gerreg2)
gerout3 <- extract.df(gerreg3)
gerout4 <- extract.df(gerreg4)


htmlreg(list(gerout1,gerout2,gerout3,gerout4), digits = 3,file = "GermanyWVS.table.html",custom.coef.names = c("Constant","Cultural Conservatism","Left Economic Attitudes","Cultural Conservatism x Left Economic Attitudes","Female","Age","College Degree","Household Income", "Confidence in Institutions","Political Engagement","Financial Satisfaction"),caption.above = T,caption = "Table D-5: Predictors of Openness to Authoritarain Governance in Germany WVS Dataset",custom.note = ("%stars. <br> Continuous predictors are mean-centered and scaled by two standard deviations. Binary predictors are coded 0-1.<br>The outcome variable is coded to range from 0.0 to 1.0 <br> Missing data were replaced using multiple imputation with results pooled across 20 copies of the dataset."),custom.gof.names = c("R<sup>2</sup>","Observations"))







#Great Britain

gb<-subset(west, subset=(country=='Great Britain'&wave3!=1), select=c(religimp, relchild, relatt, religid,
                                                                      godimp, indepchildrev, imagchildrev, obedchild, nototherrace, notimmig,immigjobs, immigatt, menbetterleaders, univboy, menrighttojobs, homosexualitynotok, abortionnotok, euthannotok, incomediffs, econresponsibility, ownershipbusiness, competgood, hardwork, wealthpositive, strongleader, armyrule, expertsdecide, democpolbad, sex, ageyears, collegedegree, hhincdecile, confparties, confgov, confparliament, politint, politimp, finansat, S017, wave5))


gbi<-mice(gb, m=20)

longgb <- complete(gbi, action='long', include=TRUE)

longgb$authgov4i<-  with(longgb, rowMeans(data.frame(strongleader,armyrule,expertsdecide,democpolbad)))


longgb$authgov3i<-  with(longgb, rowMeans(data.frame(strongleader,armyrule,democpolbad)))


longgb$cultright<-  with(longgb, rowMeans(data.frame(religimp, relchild, relatt, religid,godimp, indepchildrev, imagchildrev, obedchild, nototherrace, notimmig,immigjobs,menbetterleaders, univboy, menrighttojobs, homosexualitynotok, abortionnotok, euthannotok)))


longgb$econleft<-  with(longgb, rowMeans(data.frame(incomediffs, econresponsibility, competgood, hardwork, wealthpositive)))

longgb$age1s<-with(longgb, (ageyears-min(ageyears, na.rm=T))/(max(ageyears, na.rm=T)-min(ageyears, na.rm=T)) )

longgb$confinstit<-with(longgb, rowMeans(data.frame(confparties, confgov, confparliament)))

longgb$poleng<-with(longgb, rowMeans(data.frame(politint, politimp)))


longgb$cultrightplussd<-with(longgb, cultright-(mean(cultright, na.rm=T)+sd(cultright, na.rm=T)))

longgb$cultrightminussd<-with(longgb, cultright-(mean(cultright, na.rm=T)-sd(cultright, na.rm=T)))

longgb$econleftplussd<-with(longgb, econleft-(mean(econleft, na.rm=T)+sd(econleft, na.rm=T)))

longgb$econleftminussd<-with(longgb, econleft-(mean(econleft, na.rm=T)-sd(econleft, na.rm=T)))


longgb$cultrightscl<-with(longgb, (cultright-mean(cultright, na.rm=T))/(2*sd(cultright, na.rm=T)))

longgb$econleftscl<-with(longgb, (econleft-mean(econleft, na.rm=T))/(2*sd(econleft, na.rm=T)))


longgb$age1sscl<-with(longgb, (age1s-mean(age1s, na.rm=T))/(2*sd(age1s, na.rm=T)))


longgb$confinstitscl<-with(longgb, (confinstit-mean(confinstit, na.rm=T))/(2*sd(confinstit, na.rm=T)))


longgb$polengscl<-with(longgb, (poleng-mean(poleng, na.rm=T))/(2*sd(poleng, na.rm=T)))


longgb$hhincdecilescl<-with(longgb, (hhincdecile-mean(hhincdecile, na.rm=T))/(2*sd(hhincdecile, na.rm=T)))


longgb$finansatscl<-with(longgb, (finansat-mean(finansat, na.rm=T))/(2*sd(finansat, na.rm=T)))

longgb$econextrem<-abs(with(longgb, (econleft-mean(econleft, na.rm=T))))

longgb$econextremscl<-with(longgb, (econextrem-mean(econextrem, na.rm=T))/(2*sd(econextrem, na.rm=T)))


gbi2 <- as.mids(longgb)

gbdatlist <- miceadds::mids2datlist(gbi2)

gbreg1<- with(gbdatlist,lm(authgov3i~cultrightscl+econleftscl, weights = S017))

gbreg2<- with(gbdatlist,lm(authgov3i~cultrightscl+econleftscl+cultrightscl:econleftscl, weights = S017))


gbreg3<- with(gbdatlist,lm(authgov3i~cultrightscl+econleftscl+sex+age1sscl+collegedegree+hhincdecilescl+confinstitscl+polengscl+finansatscl, weights = S017))


gbreg4<- with(gbdatlist,lm(authgov3i~cultrightscl+econleftscl+sex+age1sscl+collegedegree+hhincdecilescl+confinstitscl+polengscl+finansatscl+cultrightscl:econleftscl, weights = S017))





gbregright<- with(gbdatlist,lm(authgov3i~cultrightplussd+econleftminussd+cultrightplussd:econleftminussd, weights = S017))


gbregleft<- with(gbdatlist,lm(authgov3i~cultrightminussd+econleftplussd+cultrightminussd:econleftplussd, weights = S017))


gbregprot<- with(gbdatlist,lm(authgov3i~cultrightplussd+econleftplussd+cultrightplussd:econleftplussd, weights = S017))


gbregfree<- with(gbdatlist,lm(authgov3i~cultrightminussd+econleftminussd+cultrightminussd:econleftminussd, weights = S017))




gbcultb <- extract.cis(gbreg1)[2,1]
gbcultlower <- extract.cis(gbreg1)[2,5]
gbcultupper <-extract.cis(gbreg1)[2,6]

gbeconb <- extract.cis(gbreg1)[3,1]
gbeconlower <- extract.cis(gbreg1)[3,5]
gbeconupper <-extract.cis(gbreg1)[3,6]


gbintb <- extract.cis(gbreg2)[4,1]
gbintlower <- extract.cis(gbreg2)[4,5]
gbintupper <-extract.cis(gbreg2)[4,6]

gbrightest<-extract.cis(gbregright)[1,1]
gbrightlower<-extract.cis(gbregright)[1,5]
gbrightupper<-extract.cis(gbregright)[1,6]

gbleftest<-extract.cis(gbregleft)[1,1]
gbleftlower<-extract.cis(gbregleft)[1,5]
gbleftupper<-extract.cis(gbregleft)[1,6]

gbprotest<-extract.cis(gbregprot)[1,1]
gbprotlower<-extract.cis(gbregprot)[1,5]
gbprotupper<-extract.cis(gbregprot)[1,6]

gbfreeest<-extract.cis(gbregfree)[1,1]
gbfreelower<-extract.cis(gbregfree)[1,5]
gbfreeupper<-extract.cis(gbregfree)[1,6]


gbcultb3<-extract.cis(gbreg3)[2,1]
gbpolengb3<-extract.cis(gbreg3)[9,1]
gbageb3<-extract.cis(gbreg3)[5,1]
gbcollegeb3<-extract.cis(gbreg3)[6,1]
gbconfinstitb3<-extract.cis(gbreg3)[8,1]



gbout1 <- extract.df(gbreg1)
gbout2 <- extract.df(gbreg2)
gbout3 <- extract.df(gbreg3)
gbout4 <- extract.df(gbreg4)


htmlreg(list(gbout1,gbout2,gbout3,gbout4), digits = 3,file = "GreatBritainWVS.table.html",custom.coef.names = c("Constant","Cultural Conservatism","Left Economic Attitudes","Cultural Conservatism x Left Economic Attitudes","Female","Age","College Degree","Household Income", "Confidence in Institutions","Political Engagement","Financial Satisfaction"),caption.above = T,caption = "Table D-6: Predictors of Openness to Authoritarain Governance in Great Britain WVS Dataset",custom.note = ("%stars. <br> Continuous predictors are mean-centered and scaled by two standard deviations. Binary predictors are coded 0-1.<br>The outcome variable is coded to range from 0.0 to 1.0 <br> Missing data were replaced using multiple imputation with results pooled across 20 copies of the dataset."),custom.gof.names = c("R<sup>2</sup>","Observations"))








#Italy

ita<-subset(west, subset=(country=='Italy'), select=c(religimp, relchild, relatt, religid,
                                                      godimp, indepchildrev, imagchildrev, obedchild, nototherrace, notimmig,immigjobs, immigatt, menbetterleaders, univboy, menrighttojobs, homosexualitynotok, abortionnotok, euthannotok, incomediffs, econresponsibility, ownershipbusiness, competgood, hardwork, wealthpositive, strongleader, armyrule, expertsdecide, democpolbad, sex, ageyears, collegedegree, hhincdecile, confparties, confgov, confparliament, politint, politimp, finansat, S017))


itai<-mice(ita, m=20)

longita <- complete(itai, action='long', include=TRUE)

longita$authgov4i<-  with(longita, rowMeans(data.frame(strongleader,armyrule,expertsdecide,democpolbad)))


longita$authgov3i<-  with(longita, rowMeans(data.frame(strongleader,armyrule,democpolbad)))

longita$cultright<-  with(longita, rowMeans(data.frame(religimp, relchild, relatt, religid,
                                                       godimp, indepchildrev, imagchildrev, obedchild, nototherrace, notimmig,immigjobs, immigatt, menbetterleaders, univboy, menrighttojobs, homosexualitynotok, abortionnotok, euthannotok)))


longita$econleft<-  with(longita, rowMeans(data.frame(incomediffs, econresponsibility, ownershipbusiness, competgood, hardwork, wealthpositive)))

longita$age1s<-with(longita, (ageyears-min(ageyears, na.rm=T))/(max(ageyears, na.rm=T)-min(ageyears, na.rm=T)) )

longita$confinstit<-with(longita, rowMeans(data.frame(confparties, confgov, confparliament)))

longita$poleng<-with(longita, rowMeans(data.frame(politint, politimp)))


longita$cultrightplussd<-with(longita, cultright-(mean(cultright, na.rm=T)+sd(cultright, na.rm=T)))

longita$cultrightminussd<-with(longita, cultright-(mean(cultright, na.rm=T)-sd(cultright, na.rm=T)))

longita$econleftplussd<-with(longita, econleft-(mean(econleft, na.rm=T)+sd(econleft, na.rm=T)))

longita$econleftminussd<-with(longita, econleft-(mean(econleft, na.rm=T)-sd(econleft, na.rm=T)))

longita$cultrightscl<-with(longita, (cultright-mean(cultright, na.rm=T))/(2*sd(cultright, na.rm=T)))

longita$econleftscl<-with(longita, (econleft-mean(econleft, na.rm=T))/(2*sd(econleft, na.rm=T)))


longita$age1sscl<-with(longita, (age1s-mean(age1s, na.rm=T))/(2*sd(age1s, na.rm=T)))


longita$confinstitscl<-with(longita, (confinstit-mean(confinstit, na.rm=T))/(2*sd(confinstit, na.rm=T)))


longita$polengscl<-with(longita, (poleng-mean(poleng, na.rm=T))/(2*sd(poleng, na.rm=T)))


longita$hhincdecilescl<-with(longita, (hhincdecile-mean(hhincdecile, na.rm=T))/(2*sd(hhincdecile, na.rm=T)))


longita$finansatscl<-with(longita, (finansat-mean(finansat, na.rm=T))/(2*sd(finansat, na.rm=T)))

longita$econextrem<-abs(with(longita, (econleft-mean(econleft, na.rm=T))))

longita$econextremscl<-with(longita, (econextrem-mean(econextrem, na.rm=T))/(2*sd(econextrem, na.rm=T)))


itai2 <- as.mids(longita)

itadatlist <- miceadds::mids2datlist(itai2)

itareg1<- with(itadatlist,lm(authgov3i~cultrightscl+econleftscl, weights = S017))

itareg2<- with(itadatlist,lm(authgov3i~cultrightscl+econleftscl+cultrightscl:econleftscl, weights = S017))


itareg3<- with(itadatlist,lm(authgov3i~cultrightscl+econleftscl+sex+age1sscl+collegedegree+hhincdecilescl+confinstitscl+polengscl+finansatscl, weights = S017))


itareg4<- with(itadatlist,lm(authgov3i~cultrightscl+econleftscl+sex+age1sscl+collegedegree+hhincdecilescl+confinstitscl+polengscl+finansatscl+cultrightscl:econleftscl, weights = S017))






itaregright<- with(itadatlist,lm(authgov3i~cultrightplussd+econleftminussd+cultrightplussd:econleftminussd, weights = S017))


itaregleft<- with(itadatlist,lm(authgov3i~cultrightminussd+econleftplussd+cultrightminussd:econleftplussd, weights = S017))


itaregprot<- with(itadatlist,lm(authgov3i~cultrightplussd+econleftplussd+cultrightplussd:econleftplussd, weights = S017))


itaregfree<- with(itadatlist,lm(authgov3i~cultrightminussd+econleftminussd+cultrightminussd:econleftminussd, weights = S017))




itacultb <- extract.cis(itareg1)[2,1]
itacultlower <- extract.cis(itareg1)[2,5]
itacultupper <-extract.cis(itareg1)[2,6]

itaeconb <- extract.cis(itareg1)[3,1]
itaeconlower <- extract.cis(itareg1)[3,5]
itaeconupper <-extract.cis(itareg1)[3,6]


itaintb <- extract.cis(itareg2)[4,1]
itaintlower <- extract.cis(itareg2)[4,5]
itaintupper <-extract.cis(itareg2)[4,6]

itarightest<-extract.cis(itaregright)[1,1]
itarightlower<-extract.cis(itaregright)[1,5]
itarightupper<-extract.cis(itaregright)[1,6]

italeftest<-extract.cis(itaregleft)[1,1]
italeftlower<-extract.cis(itaregleft)[1,5]
italeftupper<-extract.cis(itaregleft)[1,6]

itaprotest<-extract.cis(itaregprot)[1,1]
itaprotlower<-extract.cis(itaregprot)[1,5]
itaprotupper<-extract.cis(itaregprot)[1,6]

itafreeest<-extract.cis(itaregfree)[1,1]
itafreelower<-extract.cis(itaregfree)[1,5]
itafreeupper<-extract.cis(itaregfree)[1,6]



itacultb3<-extract.cis(itareg3)[2,1]
itapolengb3<-extract.cis(itareg3)[9,1]
itaageb3<-extract.cis(itareg3)[5,1]
itacollegeb3<-extract.cis(itareg3)[6,1]
itaconfinstitb3<-extract.cis(itareg3)[8,1]



itaout1 <- extract.df(itareg1)
itaout2 <- extract.df(itareg2)
itaout3 <- extract.df(itareg3)
itaout4 <- extract.df(itareg4)


htmlreg(list(itaout1,itaout2,itaout3,itaout4), digits = 3,file = "ItalyWVS.table.html",custom.coef.names = c("Constant","Cultural Conservatism","Left Economic Attitudes","Cultural Conservatism x Left Economic Attitudes","Female","Age","College Degree","Household Income", "Confidence in Institutions","Political Engagement","Financial Satisfaction"),caption.above = T,caption = "Table D-7: Predictors of Openness to Authoritarain Governance in Italy WVS Dataset",custom.note = ("%stars. <br> Continuous predictors are mean-centered and scaled by two standard deviations. Binary predictors are coded 0-1.<br>The outcome variable is coded to range from 0.0 to 1.0 <br> Missing data were replaced using multiple imputation with results pooled across 20 copies of the dataset."),custom.gof.names = c("R<sup>2</sup>","Observations"))






#Netherlands


nth<-subset(west, subset=(country=='Netherlands'), select=c(religimp, relchild, relatt, religid,
                                                      godimp, indepchildrev, imagchildrev, obedchild, nototherrace, notimmig,immigjobs, immigatt, menbetterleaders, univboy, menrighttojobs, homosexualitynotok, abortionnotok, euthannotok, incomediffs, econresponsibility, ownershipbusiness, competgood, hardwork, wealthpositive, strongleader, armyrule, expertsdecide, democpolbad, sex, ageyears, collegedegree, hhincdecile, confparties, confgov, confparliament, politint, politimp, finansat, S017, wave6))


nthi<-mice(nth, m=20)

longnth <- complete(nthi, action='long', include=TRUE)

longnth$authgov4i<-  with(longnth, rowMeans(data.frame(strongleader,armyrule,expertsdecide,democpolbad)))


longnth$authgov3i<-  with(longnth, rowMeans(data.frame(strongleader,armyrule,democpolbad)))

longnth$cultright<-  with(longnth, rowMeans(data.frame(religimp, relchild, relatt, religid,
                                                       godimp, indepchildrev, imagchildrev, obedchild, nototherrace, notimmig,immigjobs, menbetterleaders, univboy, menrighttojobs, homosexualitynotok, abortionnotok, euthannotok)))


longnth$econleft<-  with(longnth, rowMeans(data.frame(incomediffs, econresponsibility, ownershipbusiness, competgood, hardwork, wealthpositive)))

longnth$age1s<-with(longnth, (ageyears-min(ageyears, na.rm=T))/(max(ageyears, na.rm=T)-min(ageyears, na.rm=T)) )

longnth$confinstit<-with(longnth, rowMeans(data.frame(confparties, confgov, confparliament)))

longnth$poleng<-with(longnth, rowMeans(data.frame(politint, politimp)))


longnth$cultrightplussd<-with(longnth, cultright-(mean(cultright, na.rm=T)+sd(cultright, na.rm=T)))

longnth$cultrightminussd<-with(longnth, cultright-(mean(cultright, na.rm=T)-sd(cultright, na.rm=T)))

longnth$econleftplussd<-with(longnth, econleft-(mean(econleft, na.rm=T)+sd(econleft, na.rm=T)))

longnth$econleftminussd<-with(longnth, econleft-(mean(econleft, na.rm=T)-sd(econleft, na.rm=T)))


longnth$cultrightscl<-with(longnth, (cultright-mean(cultright, na.rm=T))/(2*sd(cultright, na.rm=T)))

longnth$econleftscl<-with(longnth, (econleft-mean(econleft, na.rm=T))/(2*sd(econleft, na.rm=T)))


longnth$age1sscl<-with(longnth, (age1s-mean(age1s, na.rm=T))/(2*sd(age1s, na.rm=T)))


longnth$confinstitscl<-with(longnth, (confinstit-mean(confinstit, na.rm=T))/(2*sd(confinstit, na.rm=T)))


longnth$polengscl<-with(longnth, (poleng-mean(poleng, na.rm=T))/(2*sd(poleng, na.rm=T)))


longnth$hhincdecilescl<-with(longnth, (hhincdecile-mean(hhincdecile, na.rm=T))/(2*sd(hhincdecile, na.rm=T)))


longnth$finansatscl<-with(longnth, (finansat-mean(finansat, na.rm=T))/(2*sd(finansat, na.rm=T)))

longnth$econextrem<-abs(with(longnth, (econleft-mean(econleft, na.rm=T))))

longnth$econextremscl<-with(longnth, (econextrem-mean(econextrem, na.rm=T))/(2*sd(econextrem, na.rm=T)))


nthi2 <- as.mids(longnth)

nthdatlist <- miceadds::mids2datlist(nthi2)

nthreg1<- with(nthdatlist,lm(authgov3i~cultrightscl+econleftscl, weights = S017))

nthreg2<- with(nthdatlist,lm(authgov3i~cultrightscl+econleftscl+cultrightscl:econleftscl, weights = S017))


nthreg3<- with(nthdatlist,lm(authgov3i~cultrightscl+econleftscl+sex+age1sscl+collegedegree+hhincdecilescl+confinstitscl+polengscl+finansatscl, weights = S017))


nthreg4<- with(nthdatlist,lm(authgov3i~cultrightscl+econleftscl+sex+age1sscl+collegedegree+hhincdecilescl+confinstitscl+polengscl+finansatscl+cultrightscl:econleftscl, weights = S017))




nthregright<- with(nthdatlist,lm(authgov3i~cultrightplussd+econleftminussd+cultrightplussd:econleftminussd, weights = S017))

nthregleft<- with(nthdatlist,lm(authgov3i~cultrightminussd+econleftplussd+cultrightminussd:econleftplussd, weights = S017))

nthregprot<- with(nthdatlist,lm(authgov3i~cultrightplussd+econleftplussd+cultrightplussd:econleftplussd, weights = S017))

nthregfree<- with(nthdatlist,lm(authgov3i~cultrightminussd+econleftminussd+cultrightminussd:econleftminussd, weights = S017))




nthcultb <- extract.cis(nthreg1)[2,1]
nthcultlower <- extract.cis(nthreg1)[2,5]
nthcultupper <-extract.cis(nthreg1)[2,6]

ntheconb <- extract.cis(nthreg1)[3,1]
ntheconlower <- extract.cis(nthreg1)[3,5]
ntheconupper <-extract.cis(nthreg1)[3,6]


nthintb <- extract.cis(nthreg2)[4,1]
nthintlower <- extract.cis(nthreg2)[4,5]
nthintupper <-extract.cis(nthreg2)[4,6]

nthrightest<-extract.cis(nthregright)[1,1]
nthrightlower<-extract.cis(nthregright)[1,5]
nthrightupper<-extract.cis(nthregright)[1,6]

nthleftest<-extract.cis(nthregleft)[1,1]
nthleftlower<-extract.cis(nthregleft)[1,5]
nthleftupper<-extract.cis(nthregleft)[1,6]

nthprotest<-extract.cis(nthregprot)[1,1]
nthprotlower<-extract.cis(nthregprot)[1,5]
nthprotupper<-extract.cis(nthregprot)[1,6]

nthfreeest<-extract.cis(nthregfree)[1,1]
nthfreelower<-extract.cis(nthregfree)[1,5]
nthfreeupper<-extract.cis(nthregfree)[1,6]



nthcultb3<-extract.cis(nthreg3)[2,1]
nthpolengb3<-extract.cis(nthreg3)[9,1]
nthageb3<-extract.cis(nthreg3)[5,1]
nthcollegeb3<-extract.cis(nthreg3)[6,1]
nthconfinstitb3<-extract.cis(nthreg3)[8,1]



nthout1 <- extract.df(nthreg1)
nthout2 <- extract.df(nthreg2)
nthout3 <- extract.df(nthreg3)
nthout4 <- extract.df(nthreg4)


htmlreg(list(nthout1,nthout2,nthout3,nthout4), digits = 3,file = "NetherlandsWVS.table.html",custom.coef.names = c("Constant","Cultural Conservatism","Left Economic Attitudes","Cultural Conservatism x Left Economic Attitudes","Female","Age","College Degree","Household Income", "Confidence in Institutions","Political Engagement","Financial Satisfaction"),caption.above = T,caption = "Table D-8: Predictors of Openness to Authoritarain Governance in Netherlands WVS Dataset",custom.note = ("%stars. <br> Continuous predictors are mean-centered and scaled by two standard deviations. Binary predictors are coded 0-1.<br>The outcome variable is coded to range from 0.0 to 1.0 <br> Missing data were replaced using multiple imputation with results pooled across 20 copies of the dataset."),custom.gof.names = c("R<sup>2</sup>","Observations"))








#New Zealand

nz<-subset(west, subset=(country=='New Zealand'), select=c(religimp, relchild, relatt, religid,
                                                      godimp, indepchildrev, imagchildrev, obedchild, nototherrace, notimmig,immigjobs, immigatt, menbetterleaders, univboy, menrighttojobs, homosexualitynotok, abortionnotok, euthannotok, incomediffs, econresponsibility, ownershipbusiness, competgood, hardwork, wealthpositive, strongleader, armyrule, expertsdecide, democpolbad, sex, ageyears, collegedegree, hhincdecile, confparties, confgov, confparliament, politint, politimp, finansat, S017, wave5, wave6))


nzi<-mice(nz, m=20)

longnz <- complete(nzi, action='long', include=TRUE)

longnz$authgov4i<-  with(longnz, rowMeans(data.frame(strongleader,armyrule,expertsdecide,democpolbad)))



longnz$authgov3i<-  with(longnz, rowMeans(data.frame(strongleader,armyrule,democpolbad)))



longnz$cultright<-  with(longnz, rowMeans(data.frame(religimp, relchild, relatt, religid,
                                                       godimp, indepchildrev, imagchildrev, obedchild, nototherrace, notimmig,immigjobs, immigatt, menbetterleaders, univboy, menrighttojobs, homosexualitynotok, abortionnotok, euthannotok)))


longnz$econleft<-  with(longnz, rowMeans(data.frame(incomediffs, econresponsibility, ownershipbusiness, competgood, hardwork, wealthpositive)))

longnz$age1s<-with(longnz, (ageyears-min(ageyears, na.rm=T))/(max(ageyears, na.rm=T)-min(ageyears, na.rm=T)) )

longnz$confinstit<-with(longnz, rowMeans(data.frame(confparties, confgov, confparliament)))

longnz$poleng<-with(longnz, rowMeans(data.frame(politint, politimp)))


longnz$cultrightplussd<-with(longnz, cultright-(mean(cultright, na.rm=T)+sd(cultright, na.rm=T)))

longnz$cultrightminussd<-with(longnz, cultright-(mean(cultright, na.rm=T)-sd(cultright, na.rm=T)))

longnz$econleftplussd<-with(longnz, econleft-(mean(econleft, na.rm=T)+sd(econleft, na.rm=T)))

longnz$econleftminussd<-with(longnz, econleft-(mean(econleft, na.rm=T)-sd(econleft, na.rm=T)))


longnz$cultrightscl<-with(longnz, (cultright-mean(cultright, na.rm=T))/(2*sd(cultright, na.rm=T)))

longnz$econleftscl<-with(longnz, (econleft-mean(econleft, na.rm=T))/(2*sd(econleft, na.rm=T)))


longnz$age1sscl<-with(longnz, (age1s-mean(age1s, na.rm=T))/(2*sd(age1s, na.rm=T)))


longnz$confinstitscl<-with(longnz, (confinstit-mean(confinstit, na.rm=T))/(2*sd(confinstit, na.rm=T)))


longnz$polengscl<-with(longnz, (poleng-mean(poleng, na.rm=T))/(2*sd(poleng, na.rm=T)))


longnz$hhincdecilescl<-with(longnz, (hhincdecile-mean(hhincdecile, na.rm=T))/(2*sd(hhincdecile, na.rm=T)))


longnz$finansatscl<-with(longnz, (finansat-mean(finansat, na.rm=T))/(2*sd(finansat, na.rm=T)))

longnz$econextrem<-abs(with(longnz, (econleft-mean(econleft, na.rm=T))))

longnz$econextremscl<-with(longnz, (econextrem-mean(econextrem, na.rm=T))/(2*sd(econextrem, na.rm=T)))


nzi2 <- as.mids(longnz)

nzdatlist <- miceadds::mids2datlist(nzi2)

nzreg1<- with(nzdatlist,lm(authgov3i~cultrightscl+econleftscl, weights = S017))

nzreg2<- with(nzdatlist,lm(authgov3i~cultrightscl+econleftscl+cultrightscl:econleftscl, weights = S017))


nzreg3<- with(nzdatlist,lm(authgov3i~cultrightscl+econleftscl+sex+age1sscl+collegedegree+hhincdecilescl+confinstitscl+polengscl+finansatscl, weights = S017))


nzreg4<- with(nzdatlist,lm(authgov3i~cultrightscl+econleftscl+sex+age1sscl+collegedegree+hhincdecilescl+confinstitscl+polengscl+finansatscl+cultrightscl:econleftscl, weights = S017))



nzregright<- with(nzdatlist,lm(authgov3i~cultrightplussd+econleftminussd+cultrightplussd:econleftminussd, weights = S017))


nzregleft<- with(nzdatlist,lm(authgov3i~cultrightminussd+econleftplussd+cultrightminussd:econleftplussd, weights = S017))


nzregprot<- with(nzdatlist,lm(authgov3i~cultrightplussd+econleftplussd+cultrightplussd:econleftplussd, weights = S017))


nzregfree<- with(nzdatlist,lm(authgov3i~cultrightminussd+econleftminussd+cultrightminussd:econleftminussd, weights = S017))




nzcultb <- extract.cis(nzreg1)[2,1]
nzcultlower <- extract.cis(nzreg1)[2,5]
nzcultupper <-extract.cis(nzreg1)[2,6]

nzeconb <- extract.cis(nzreg1)[3,1]
nzeconlower <- extract.cis(nzreg1)[3,5]
nzeconupper <-extract.cis(nzreg1)[3,6]


nzintb <- extract.cis(nzreg2)[4,1]
nzintlower <- extract.cis(nzreg2)[4,5]
nzintupper <-extract.cis(nzreg2)[4,6]

nzrightest<-extract.cis(nzregright)[1,1]
nzrightlower<-extract.cis(nzregright)[1,5]
nzrightupper<-extract.cis(nzregright)[1,6]

nzleftest<-extract.cis(nzregleft)[1,1]
nzleftlower<-extract.cis(nzregleft)[1,5]
nzleftupper<-extract.cis(nzregleft)[1,6]

nzprotest<-extract.cis(nzregprot)[1,1]
nzprotlower<-extract.cis(nzregprot)[1,5]
nzprotupper<-extract.cis(nzregprot)[1,6]

nzfreeest<-extract.cis(nzregfree)[1,1]
nzfreelower<-extract.cis(nzregfree)[1,5]
nzfreeupper<-extract.cis(nzregfree)[1,6]



nzcultb3<-extract.cis(nzreg3)[2,1]
nzpolengb3<-extract.cis(nzreg3)[9,1]
nzageb3<-extract.cis(nzreg3)[5,1]
nzcollegeb3<-extract.cis(nzreg3)[6,1]
nzconfinstitb3<-extract.cis(nzreg3)[8,1]



nzout1 <- extract.df(nzreg1)
nzout2 <- extract.df(nzreg2)
nzout3 <- extract.df(nzreg3)
nzout4 <- extract.df(nzreg4)


htmlreg(list(nzout1,nzout2,nzout3,nzout4), digits = 3,file = "NewZealandWVS.table.html",custom.coef.names = c("Constant","Cultural Conservatism","Left Economic Attitudes","Cultural Conservatism x Left Economic Attitudes","Female","Age","College Degree","Household Income", "Confidence in Institutions","Political Engagement","Financial Satisfaction"),caption.above = T,caption = "Table D-9: Predictors of Openness to Authoritarain Governance in New Zealand WVS Dataset",custom.note = ("%stars. <br> Continuous predictors are mean-centered and scaled by two standard deviations. Binary predictors are coded 0-1.<br>The outcome variable is coded to range from 0.0 to 1.0 <br> Missing data were replaced using multiple imputation with results pooled across 20 copies of the dataset."),custom.gof.names = c("R<sup>2</sup>","Observations"))







#Norway

nor<-subset(west, subset=(country=='Norway'), select=c(religimp, relchild, relatt, religid,
                                                           godimp, indepchildrev, imagchildrev, obedchild, nototherrace, notimmig,immigjobs, immigatt, menbetterleaders, univboy, menrighttojobs, homosexualitynotok, abortionnotok, euthannotok, incomediffs, econresponsibility, ownershipbusiness, competgood, hardwork, wealthpositive, strongleader, armyrule, expertsdecide, democpolbad, sex, ageyears, collegedegree, hhincdecile, confparties, confgov, confparliament, politint, politimp, finansat, S017, wave5))


nori<-mice(nor, m=20)

longnor <- complete(nori, action='long', include=TRUE)

longnor$authgov4i<-  with(longnor, rowMeans(data.frame(strongleader,armyrule,expertsdecide,democpolbad)))


longnor$authgov3i<-  with(longnor, rowMeans(data.frame(strongleader,armyrule,democpolbad)))

longnor$cultright<-  with(longnor, rowMeans(data.frame(religimp, relchild, relatt, religid,
                                                     godimp, indepchildrev, imagchildrev, obedchild, nototherrace, notimmig,immigjobs, immigatt, menbetterleaders, univboy, menrighttojobs, homosexualitynotok, abortionnotok, euthannotok)))


longnor$econleft<-  with(longnor, rowMeans(data.frame(incomediffs, econresponsibility, ownershipbusiness, competgood, hardwork, wealthpositive)))

longnor$age1s<-with(longnor, (ageyears-min(ageyears, na.rm=T))/(max(ageyears, na.rm=T)-min(ageyears, na.rm=T)) )

longnor$confinstit<-with(longnor, rowMeans(data.frame(confparties, confgov, confparliament)))

longnor$poleng<-with(longnor, rowMeans(data.frame(politint, politimp)))


longnor$cultrightplussd<-with(longnor, cultright-(mean(cultright, na.rm=T)+sd(cultright, na.rm=T)))

longnor$cultrightminussd<-with(longnor, cultright-(mean(cultright, na.rm=T)-sd(cultright, na.rm=T)))

longnor$econleftplussd<-with(longnor, econleft-(mean(econleft, na.rm=T)+sd(econleft, na.rm=T)))

longnor$econleftminussd<-with(longnor, econleft-(mean(econleft, na.rm=T)-sd(econleft, na.rm=T)))

longnor$cultrightscl<-with(longnor, (cultright-mean(cultright, na.rm=T))/(2*sd(cultright, na.rm=T)))

longnor$econleftscl<-with(longnor, (econleft-mean(econleft, na.rm=T))/(2*sd(econleft, na.rm=T)))


longnor$age1sscl<-with(longnor, (age1s-mean(age1s, na.rm=T))/(2*sd(age1s, na.rm=T)))


longnor$confinstitscl<-with(longnor, (confinstit-mean(confinstit, na.rm=T))/(2*sd(confinstit, na.rm=T)))


longnor$polengscl<-with(longnor, (poleng-mean(poleng, na.rm=T))/(2*sd(poleng, na.rm=T)))


longnor$hhincdecilescl<-with(longnor, (hhincdecile-mean(hhincdecile, na.rm=T))/(2*sd(hhincdecile, na.rm=T)))


longnor$finansatscl<-with(longnor, (finansat-mean(finansat, na.rm=T))/(2*sd(finansat, na.rm=T)))

longnor$econextrem<-abs(with(longnor, (econleft-mean(econleft, na.rm=T))))

longnor$econextremscl<-with(longnor, (econextrem-mean(econextrem, na.rm=T))/(2*sd(econextrem, na.rm=T)))


nori2 <- as.mids(longnor)

nordatlist <- miceadds::mids2datlist(nori2)

norreg1<- with(nordatlist,lm(authgov3i~cultrightscl+econleftscl, weights = S017))

norreg2<- with(nordatlist,lm(authgov3i~cultrightscl+econleftscl+cultrightscl:econleftscl, weights = S017))


norreg3<- with(nordatlist,lm(authgov3i~cultrightscl+econleftscl+sex+age1sscl+collegedegree+hhincdecilescl+confinstitscl+polengscl+finansatscl, weights = S017))


norreg4<- with(nordatlist,lm(authgov3i~cultrightscl+econleftscl+sex+age1sscl+collegedegree+hhincdecilescl+confinstitscl+polengscl+finansatscl+cultrightscl:econleftscl, weights = S017))




norregright<- with(nordatlist,lm(authgov3i~cultrightplussd+econleftminussd+cultrightplussd:econleftminussd, weights = S017))


norregleft<- with(nordatlist,lm(authgov3i~cultrightminussd+econleftplussd+cultrightminussd:econleftplussd, weights = S017))


norregprot<- with(nordatlist,lm(authgov3i~cultrightplussd+econleftplussd+cultrightplussd:econleftplussd, weights = S017))


norregfree<- with(nordatlist,lm(authgov3i~cultrightminussd+econleftminussd+cultrightminussd:econleftminussd, weights = S017))




norcultb <- extract.cis(norreg1)[2,1]
norcultlower <- extract.cis(norreg1)[2,5]
norcultupper <-extract.cis(norreg1)[2,6]

noreconb <- extract.cis(norreg1)[3,1]
noreconlower <- extract.cis(norreg1)[3,5]
noreconupper <-extract.cis(norreg1)[3,6]


norintb <- extract.cis(norreg2)[4,1]
norintlower <- extract.cis(norreg2)[4,5]
norintupper <-extract.cis(norreg2)[4,6]

norrightest<-extract.cis(norregright)[1,1]
norrightlower<-extract.cis(norregright)[1,5]
norrightupper<-extract.cis(norregright)[1,6]

norleftest<-extract.cis(norregleft)[1,1]
norleftlower<-extract.cis(norregleft)[1,5]
norleftupper<-extract.cis(norregleft)[1,6]

norprotest<-extract.cis(norregprot)[1,1]
norprotlower<-extract.cis(norregprot)[1,5]
norprotupper<-extract.cis(norregprot)[1,6]

norfreeest<-extract.cis(norregfree)[1,1]
norfreelower<-extract.cis(norregfree)[1,5]
norfreeupper<-extract.cis(norregfree)[1,6]



norcultb3<-extract.cis(norreg3)[2,1]
norpolengb3<-extract.cis(norreg3)[9,1]
norageb3<-extract.cis(norreg3)[5,1]
norcollegeb3<-extract.cis(norreg3)[6,1]
norconfinstitb3<-extract.cis(norreg3)[8,1]



norout1 <- extract.df(norreg1)
norout2 <- extract.df(norreg2)
norout3 <- extract.df(norreg3)
norout4 <- extract.df(norreg4)


htmlreg(list(norout1,norout2,norout3,norout4), digits = 3,file = "NorwayWVS.table.html",custom.coef.names = c("Constant","Cultural Conservatism","Left Economic Attitudes","Cultural Conservatism x Left Economic Attitudes","Female","Age","College Degree","Household Income", "Confidence in Institutions","Political Engagement","Financial Satisfaction"),caption.above = T,caption = "Table D-10: Predictors of Openness to Authoritarain Governance in Norway WVS Dataset",custom.note = ("%stars. <br> Continuous predictors are mean-centered and scaled by two standard deviations. Binary predictors are coded 0-1.<br>The outcome variable is coded to range from 0.0 to 1.0 <br> Missing data were replaced using multiple imputation with results pooled across 20 copies of the dataset."),custom.gof.names = c("R<sup>2</sup>","Observations"))







#Spain

spn<-subset(west, subset=(country=='Spain'), select=c(religimp, relchild, relatt, religid,
                                                           godimp, indepchildrev, imagchildrev, obedchild, nototherrace, notimmig,immigjobs, immigatt, menbetterleaders, univboy, menrighttojobs, homosexualitynotok, abortionnotok, euthannotok, incomediffs, econresponsibility, ownershipbusiness, competgood, hardwork, wealthpositive, strongleader, armyrule, expertsdecide, democpolbad, sex, ageyears, collegedegree, hhincdecile, confparties, confgov, confparliament, politint, politimp, finansat, S017, wave4, wave5, wave6))


spni<-mice(spn, m=20)

longspn <- complete(spni, action='long', include=TRUE)

longspn$authgov4i<-  with(longspn, rowMeans(data.frame(strongleader,armyrule,expertsdecide,democpolbad)))


longspn$authgov3i<-  with(longspn, rowMeans(data.frame(strongleader,armyrule,democpolbad)))

longspn$cultright<-  with(longspn, rowMeans(data.frame(religimp, relchild, relatt, religid,
                                                     godimp, indepchildrev, imagchildrev, obedchild, nototherrace, notimmig,immigjobs, immigatt, menbetterleaders, univboy, menrighttojobs, homosexualitynotok, abortionnotok, euthannotok)))


longspn$econleft<-  with(longspn, rowMeans(data.frame(incomediffs, econresponsibility, ownershipbusiness, competgood, hardwork, wealthpositive)))

longspn$age1s<-with(longspn, (ageyears-min(ageyears, na.rm=T))/(max(ageyears, na.rm=T)-min(ageyears, na.rm=T)) )

longspn$confinstit<-with(longspn, rowMeans(data.frame(confparties, confgov, confparliament)))

longspn$poleng<-with(longspn, rowMeans(data.frame(politint, politimp)))


longspn$cultrightplussd<-with(longspn, cultright-(mean(cultright, na.rm=T)+sd(cultright, na.rm=T)))

longspn$cultrightminussd<-with(longspn, cultright-(mean(cultright, na.rm=T)-sd(cultright, na.rm=T)))

longspn$econleftplussd<-with(longspn, econleft-(mean(econleft, na.rm=T)+sd(econleft, na.rm=T)))

longspn$econleftminussd<-with(longspn, econleft-(mean(econleft, na.rm=T)-sd(econleft, na.rm=T)))


longspn$cultrightscl<-with(longspn, (cultright-mean(cultright, na.rm=T))/(2*sd(cultright, na.rm=T)))

longspn$econleftscl<-with(longspn, (econleft-mean(econleft, na.rm=T))/(2*sd(econleft, na.rm=T)))


longspn$age1sscl<-with(longspn, (age1s-mean(age1s, na.rm=T))/(2*sd(age1s, na.rm=T)))


longspn$confinstitscl<-with(longspn, (confinstit-mean(confinstit, na.rm=T))/(2*sd(confinstit, na.rm=T)))


longspn$polengscl<-with(longspn, (poleng-mean(poleng, na.rm=T))/(2*sd(poleng, na.rm=T)))


longspn$hhincdecilescl<-with(longspn, (hhincdecile-mean(hhincdecile, na.rm=T))/(2*sd(hhincdecile, na.rm=T)))


longspn$finansatscl<-with(longspn, (finansat-mean(finansat, na.rm=T))/(2*sd(finansat, na.rm=T)))

longspn$econextrem<-abs(with(longspn, (econleft-mean(econleft, na.rm=T))))

longspn$econextremscl<-with(longspn, (econextrem-mean(econextrem, na.rm=T))/(2*sd(econextrem, na.rm=T)))


spni2 <- as.mids(longspn)

spndatlist <- miceadds::mids2datlist(spni2)

spnreg1<- with(spndatlist,lm(authgov3i~cultrightscl+econleftscl, weights = S017))

spnreg2<- with(spndatlist,lm(authgov3i~cultrightscl+econleftscl+cultrightscl:econleftscl, weights = S017))


spnreg3<- with(spndatlist,lm(authgov3i~cultrightscl+econleftscl+sex+age1sscl+collegedegree+hhincdecilescl+confinstitscl+polengscl+finansatscl, weights = S017))


spnreg4<- with(spndatlist,lm(authgov3i~cultrightscl+econleftscl+sex+age1sscl+collegedegree+hhincdecilescl+confinstitscl+polengscl+finansatscl+cultrightscl:econleftscl, weights = S017))



spnregright<- with(spndatlist,lm(authgov3i~cultrightplussd+econleftminussd+cultrightplussd:econleftminussd, weights = S017))


spnregleft<- with(spndatlist,lm(authgov3i~cultrightminussd+econleftplussd+cultrightminussd:econleftplussd, weights = S017))


spnregprot<- with(spndatlist,lm(authgov3i~cultrightplussd+econleftplussd+cultrightplussd:econleftplussd, weights = S017))


spnregfree<- with(spndatlist,lm(authgov3i~cultrightminussd+econleftminussd+cultrightminussd:econleftminussd, weights = S017))




spncultb <- extract.cis(spnreg1)[2,1]
spncultlower <- extract.cis(spnreg1)[2,5]
spncultupper <-extract.cis(spnreg1)[2,6]

spneconb <- extract.cis(spnreg1)[3,1]
spneconlower <- extract.cis(spnreg1)[3,5]
spneconupper <-extract.cis(spnreg1)[3,6]


spnintb <- extract.cis(spnreg2)[4,1]
spnintlower <- extract.cis(spnreg2)[4,5]
spnintupper <-extract.cis(spnreg2)[4,6]

spnrightest<-extract.cis(spnregright)[1,1]
spnrightlower<-extract.cis(spnregright)[1,5]
spnrightupper<-extract.cis(spnregright)[1,6]

spnleftest<-extract.cis(spnregleft)[1,1]
spnleftlower<-extract.cis(spnregleft)[1,5]
spnleftupper<-extract.cis(spnregleft)[1,6]

spnprotest<-extract.cis(spnregprot)[1,1]
spnprotlower<-extract.cis(spnregprot)[1,5]
spnprotupper<-extract.cis(spnregprot)[1,6]

spnfreeest<-extract.cis(spnregfree)[1,1]
spnfreelower<-extract.cis(spnregfree)[1,5]
spnfreeupper<-extract.cis(spnregfree)[1,6]



spncultb3<-extract.cis(spnreg3)[2,1]
spnpolengb3<-extract.cis(spnreg3)[9,1]
spnageb3<-extract.cis(spnreg3)[5,1]
spncollegeb3<-extract.cis(spnreg3)[6,1]
spnconfinstitb3<-extract.cis(spnreg3)[8,1]



spnout1 <- extract.df(spnreg1)
spnout2 <- extract.df(spnreg2)
spnout3 <- extract.df(spnreg3)
spnout4 <- extract.df(spnreg4)


htmlreg(list(spnout1,spnout2,spnout3,spnout4), digits = 3,file = "SpainWVS.table.html",custom.coef.names = c("Constant","Cultural Conservatism","Left Economic Attitudes","Cultural Conservatism x Left Economic Attitudes","Female","Age","College Degree","Household Income", "Confidence in Institutions","Political Engagement","Financial Satisfaction"),caption.above = T,caption = "Table D-11: Predictors of Openness to Authoritarain Governance in Spain WVS Dataset",custom.note = ("%stars. <br> Continuous predictors are mean-centered and scaled by two standard deviations. Binary predictors are coded 0-1.<br>The outcome variable is coded to range from 0.0 to 1.0 <br> Missing data were replaced using multiple imputation with results pooled across 20 copies of the dataset."),custom.gof.names = c("R<sup>2</sup>","Observations"))







#Sweden

swe<-subset(west, subset=(country=='Sweden'), select=c(religimp, relchild, relatt, religid,
                                                      godimp, indepchildrev, imagchildrev, obedchild, nototherrace, notimmig,immigjobs, immigatt, menbetterleaders, univboy, menrighttojobs, homosexualitynotok, abortionnotok, euthannotok, incomediffs, econresponsibility, ownershipbusiness, competgood, hardwork, wealthpositive, strongleader, armyrule, expertsdecide, democpolbad, sex, ageyears, collegedegree, hhincdecile, confparties, confgov, confparliament, politint, politimp, finansat, S017, wave5, wave6))


swei<-mice(swe, m=20)

longswe <- complete(swei, action='long', include=TRUE)

longswe$authgov4i<-  with(longswe, rowMeans(data.frame(strongleader,armyrule,expertsdecide,democpolbad)))


longswe$authgov3i<-  with(longswe, rowMeans(data.frame(strongleader,armyrule,democpolbad)))


longswe$cultright<-  with(longswe, rowMeans(data.frame(religimp, relchild, relatt, religid,
                                                       godimp, indepchildrev, imagchildrev, obedchild, nototherrace, notimmig,immigjobs, immigatt, menbetterleaders, univboy, menrighttojobs, homosexualitynotok, abortionnotok, euthannotok)))


longswe$econleft<-  with(longswe, rowMeans(data.frame(incomediffs, econresponsibility, ownershipbusiness, competgood, hardwork, wealthpositive)))

longswe$age1s<-with(longswe, (ageyears-min(ageyears, na.rm=T))/(max(ageyears, na.rm=T)-min(ageyears, na.rm=T)) )

longswe$confinstit<-with(longswe, rowMeans(data.frame(confparties, confgov, confparliament)))

longswe$poleng<-with(longswe, rowMeans(data.frame(politint, politimp)))


longswe$cultrightplussd<-with(longswe, cultright-(mean(cultright, na.rm=T)+sd(cultright, na.rm=T)))

longswe$cultrightminussd<-with(longswe, cultright-(mean(cultright, na.rm=T)-sd(cultright, na.rm=T)))

longswe$econleftplussd<-with(longswe, econleft-(mean(econleft, na.rm=T)+sd(econleft, na.rm=T)))

longswe$econleftminussd<-with(longswe, econleft-(mean(econleft, na.rm=T)-sd(econleft, na.rm=T)))


longswe$cultrightscl<-with(longswe, (cultright-mean(cultright, na.rm=T))/(2*sd(cultright, na.rm=T)))

longswe$econleftscl<-with(longswe, (econleft-mean(econleft, na.rm=T))/(2*sd(econleft, na.rm=T)))


longswe$age1sscl<-with(longswe, (age1s-mean(age1s, na.rm=T))/(2*sd(age1s, na.rm=T)))


longswe$confinstitscl<-with(longswe, (confinstit-mean(confinstit, na.rm=T))/(2*sd(confinstit, na.rm=T)))


longswe$polengscl<-with(longswe, (poleng-mean(poleng, na.rm=T))/(2*sd(poleng, na.rm=T)))


longswe$hhincdecilescl<-with(longswe, (hhincdecile-mean(hhincdecile, na.rm=T))/(2*sd(hhincdecile, na.rm=T)))


longswe$finansatscl<-with(longswe, (finansat-mean(finansat, na.rm=T))/(2*sd(finansat, na.rm=T)))

longswe$econextrem<-abs(with(longswe, (econleft-mean(econleft, na.rm=T))))

longswe$econextremscl<-with(longswe, (econextrem-mean(econextrem, na.rm=T))/(2*sd(econextrem, na.rm=T)))


swei2 <- as.mids(longswe)

swedatlist <- miceadds::mids2datlist(swei2)

swereg1<- with(swedatlist,lm(authgov3i~cultrightscl+econleftscl, weights = S017))

swereg2<- with(swedatlist,lm(authgov3i~cultrightscl+econleftscl+cultrightscl:econleftscl, weights = S017))


swereg3<- with(swedatlist,lm(authgov3i~cultrightscl+econleftscl+sex+age1sscl+collegedegree+hhincdecilescl+confinstitscl+polengscl+finansatscl, weights = S017))


swereg4<- with(swedatlist,lm(authgov3i~cultrightscl+econleftscl+sex+age1sscl+collegedegree+hhincdecilescl+confinstitscl+polengscl+finansatscl+cultrightscl:econleftscl, weights = S017))


sweregright<- with(swedatlist,lm(authgov3i~cultrightplussd+econleftminussd+cultrightplussd:econleftminussd, weights = S017))


sweregleft<- with(swedatlist,lm(authgov3i~cultrightminussd+econleftplussd+cultrightminussd:econleftplussd, weights = S017))


sweregprot<- with(swedatlist,lm(authgov3i~cultrightplussd+econleftplussd+cultrightplussd:econleftplussd, weights = S017))


sweregfree<- with(swedatlist,lm(authgov3i~cultrightminussd+econleftminussd+cultrightminussd:econleftminussd, weights = S017))




swecultb <- extract.cis(swereg1)[2,1]
swecultlower <- extract.cis(swereg1)[2,5]
swecultupper <-extract.cis(swereg1)[2,6]

sweeconb <- extract.cis(swereg1)[3,1]
sweeconlower <- extract.cis(swereg1)[3,5]
sweeconupper <-extract.cis(swereg1)[3,6]


sweintb <- extract.cis(swereg2)[4,1]
sweintlower <- extract.cis(swereg2)[4,5]
sweintupper <-extract.cis(swereg2)[4,6]

swerightest<-extract.cis(sweregright)[1,1]
swerightlower<-extract.cis(sweregright)[1,5]
swerightupper<-extract.cis(sweregright)[1,6]

sweleftest<-extract.cis(sweregleft)[1,1]
sweleftlower<-extract.cis(sweregleft)[1,5]
sweleftupper<-extract.cis(sweregleft)[1,6]

sweprotest<-extract.cis(sweregprot)[1,1]
sweprotlower<-extract.cis(sweregprot)[1,5]
sweprotupper<-extract.cis(sweregprot)[1,6]

swefreeest<-extract.cis(sweregfree)[1,1]
swefreelower<-extract.cis(sweregfree)[1,5]
swefreeupper<-extract.cis(sweregfree)[1,6]


swecultb3<-extract.cis(swereg3)[2,1]
swepolengb3<-extract.cis(swereg3)[9,1]
sweageb3<-extract.cis(swereg3)[5,1]
swecollegeb3<-extract.cis(swereg3)[6,1]
sweconfinstitb3<-extract.cis(swereg3)[8,1]



sweout1 <- extract.df(swereg1)
sweout2 <- extract.df(swereg2)
sweout3 <- extract.df(swereg3)
sweout4 <- extract.df(swereg4)


htmlreg(list(sweout1,sweout2,sweout3,sweout4), digits = 3,file = "SwedenWVS.table.html",custom.coef.names = c("Constant","Cultural Conservatism","Left Economic Attitudes","Cultural Conservatism x Left Economic Attitudes","Female","Age","College Degree","Household Income", "Confidence in Institutions","Political Engagement","Financial Satisfaction"),caption.above = T,caption = "Table D-12: Predictors of Openness to Authoritarain Governance in Sweden WVS Dataset",custom.note = ("%stars. <br> Continuous predictors are mean-centered and scaled by two standard deviations. Binary predictors are coded 0-1.<br>The outcome variable is coded to range from 0.0 to 1.0 <br> Missing data were replaced using multiple imputation with results pooled across 20 copies of the dataset."),custom.gof.names = c("R<sup>2</sup>","Observations"))







#Switzerland

swi<-subset(west, subset=(country=='Switzerland'), select=c(religimp, relchild, relatt, religid,
                                                      godimp, indepchildrev, imagchildrev, obedchild, nototherrace, notimmig,immigjobs, immigatt, menbetterleaders, univboy, menrighttojobs, homosexualitynotok, abortionnotok, euthannotok, incomediffs, econresponsibility, ownershipbusiness, competgood, hardwork, wealthpositive, strongleader, armyrule, expertsdecide, democpolbad, sex, ageyears, collegedegree, hhincdecile, confparties, confgov, confparliament, politint, politimp, finansat, S017,wave5))


swii<-mice(swi, m=20)

longswi <- complete(swii, action='long', include=TRUE)

longswi$authgov4i<-  with(longswi, rowMeans(data.frame(strongleader,armyrule,expertsdecide,democpolbad)))


longswi$authgov3i<-  with(longswi, rowMeans(data.frame(strongleader,armyrule,democpolbad)))

longswi$cultright<-  with(longswi, rowMeans(data.frame(religimp, relchild, relatt, religid,
                                                       godimp, indepchildrev, imagchildrev, obedchild, nototherrace, notimmig,immigjobs, immigatt, menbetterleaders, univboy, menrighttojobs, homosexualitynotok, abortionnotok, euthannotok)))


longswi$econleft<-  with(longswi, rowMeans(data.frame(incomediffs, econresponsibility, ownershipbusiness, competgood, hardwork, wealthpositive)))

longswi$age1s<-with(longswi, (ageyears-min(ageyears, na.rm=T))/(max(ageyears, na.rm=T)-min(ageyears, na.rm=T)) )

longswi$confinstit<-with(longswi, rowMeans(data.frame(confparties, confgov, confparliament)))

longswi$poleng<-with(longswi, rowMeans(data.frame(politint, politimp)))


longswi$cultrightplussd<-with(longswi, cultright-(mean(cultright, na.rm=T)+sd(cultright, na.rm=T)))

longswi$cultrightminussd<-with(longswi, cultright-(mean(cultright, na.rm=T)-sd(cultright, na.rm=T)))

longswi$econleftplussd<-with(longswi, econleft-(mean(econleft, na.rm=T)+sd(econleft, na.rm=T)))

longswi$econleftminussd<-with(longswi, econleft-(mean(econleft, na.rm=T)-sd(econleft, na.rm=T)))

longswi$cultrightscl<-with(longswi, (cultright-mean(cultright, na.rm=T))/(2*sd(cultright, na.rm=T)))

longswi$econleftscl<-with(longswi, (econleft-mean(econleft, na.rm=T))/(2*sd(econleft, na.rm=T)))


longswi$age1sscl<-with(longswi, (age1s-mean(age1s, na.rm=T))/(2*sd(age1s, na.rm=T)))


longswi$confinstitscl<-with(longswi, (confinstit-mean(confinstit, na.rm=T))/(2*sd(confinstit, na.rm=T)))


longswi$polengscl<-with(longswi, (poleng-mean(poleng, na.rm=T))/(2*sd(poleng, na.rm=T)))


longswi$hhincdecilescl<-with(longswi, (hhincdecile-mean(hhincdecile, na.rm=T))/(2*sd(hhincdecile, na.rm=T)))


longswi$finansatscl<-with(longswi, (finansat-mean(finansat, na.rm=T))/(2*sd(finansat, na.rm=T)))

longswi$econextrem<-abs(with(longswi, (econleft-mean(econleft, na.rm=T))))

longswi$econextremscl<-with(longswi, (econextrem-mean(econextrem, na.rm=T))/(2*sd(econextrem, na.rm=T)))


swii2 <- as.mids(longswi)

swidatlist <- miceadds::mids2datlist(swii2)

swireg1<- with(swidatlist,lm(authgov3i~cultrightscl+econleftscl, weights = S017))

swireg2<- with(swidatlist,lm(authgov3i~cultrightscl+econleftscl+cultrightscl:econleftscl, weights = S017))


swireg3<- with(swidatlist,lm(authgov3i~cultrightscl+econleftscl+sex+age1sscl+collegedegree+hhincdecilescl+confinstitscl+polengscl+finansatscl, weights = S017))


swireg4<- with(swidatlist,lm(authgov3i~cultrightscl+econleftscl+sex+age1sscl+collegedegree+hhincdecilescl+confinstitscl+polengscl+finansatscl+cultrightscl:econleftscl, weights = S017))





swiregright<- with(swidatlist,lm(authgov3i~cultrightplussd+econleftminussd+cultrightplussd:econleftminussd, weights = S017))


swiregleft<- with(swidatlist,lm(authgov3i~cultrightminussd+econleftplussd+cultrightminussd:econleftplussd, weights = S017))


swiregprot<- with(swidatlist,lm(authgov3i~cultrightplussd+econleftplussd+cultrightplussd:econleftplussd, weights = S017))


swiregfree<- with(swidatlist,lm(authgov3i~cultrightminussd+econleftminussd+cultrightminussd:econleftminussd, weights = S017))




swicultb <- extract.cis(swireg1)[2,1]
swicultlower <- extract.cis(swireg1)[2,5]
swicultupper <-extract.cis(swireg1)[2,6]

swieconb <- extract.cis(swireg1)[3,1]
swieconlower <- extract.cis(swireg1)[3,5]
swieconupper <-extract.cis(swireg1)[3,6]


swiintb <- extract.cis(swireg2)[4,1]
swiintlower <- extract.cis(swireg2)[4,5]
swiintupper <-extract.cis(swireg2)[4,6]

swirightest<-extract.cis(swiregright)[1,1]
swirightlower<-extract.cis(swiregright)[1,5]
swirightupper<-extract.cis(swiregright)[1,6]

swileftest<-extract.cis(swiregleft)[1,1]
swileftlower<-extract.cis(swiregleft)[1,5]
swileftupper<-extract.cis(swiregleft)[1,6]

swiprotest<-extract.cis(swiregprot)[1,1]
swiprotlower<-extract.cis(swiregprot)[1,5]
swiprotupper<-extract.cis(swiregprot)[1,6]

swifreeest<-extract.cis(swiregfree)[1,1]
swifreelower<-extract.cis(swiregfree)[1,5]
swifreeupper<-extract.cis(swiregfree)[1,6]


swicultb3<-extract.cis(swireg3)[2,1]
swipolengb3<-extract.cis(swireg3)[9,1]
swiageb3<-extract.cis(swireg3)[5,1]
swicollegeb3<-extract.cis(swireg3)[6,1]
swiconfinstitb3<-extract.cis(swireg3)[8,1]



swiout1 <- extract.df(swireg1)
swiout2 <- extract.df(swireg2)
swiout3 <- extract.df(swireg3)
swiout4 <- extract.df(swireg4)


htmlreg(list(swiout1,swiout2,swiout3,swiout4), digits = 3,file = "SwitzerlandWVS.table.html",custom.coef.names = c("Constant","Cultural Conservatism","Left Economic Attitudes","Cultural Conservatism x Left Economic Attitudes","Female","Age","College Degree","Household Income", "Confidence in Institutions","Political Engagement","Financial Satisfaction"),caption.above = T,caption = "Table D-13: Predictors of Openness to Authoritarain Governance in Switzerland WVS Dataset",custom.note = ("%stars. <br> Continuous predictors are mean-centered and scaled by two standard deviations. Binary predictors are coded 0-1.<br>The outcome variable is coded to range from 0.0 to 1.0 <br> Missing data were replaced using multiple imputation with results pooled across 20 copies of the dataset."),custom.gof.names = c("R<sup>2</sup>","Observations"))






#United States

us<-subset(west, subset=(country=='United States'), select=c(religimp, relchild, relatt, religid,
                                                      godimp, indepchildrev, imagchildrev, obedchild, nototherrace, notimmig,immigjobs, immigatt, menbetterleaders, univboy, menrighttojobs, homosexualitynotok, abortionnotok, euthannotok, incomediffs, econresponsibility, ownershipbusiness, competgood, hardwork, wealthpositive, strongleader, armyrule, expertsdecide, democpolbad, sex, ageyears, collegedegree, hhincdecile, confparties, confgov, confparliament, politint, politimp, finansat, S017, wave4, wave5, wave6))


usi<-mice(us, m=20)

longus <- complete(usi, action='long', include=TRUE)

longus$authgov4i<-  with(longus, rowMeans(data.frame(strongleader,armyrule,expertsdecide,democpolbad)))

longus$authgov3i<-  with(longus, rowMeans(data.frame(strongleader,armyrule,democpolbad)))

longus$cultright<-  with(longus, rowMeans(data.frame(religimp, relchild, relatt, religid,
                                                       godimp, indepchildrev, imagchildrev, obedchild, nototherrace, notimmig,immigjobs, immigatt, menbetterleaders, univboy, menrighttojobs, homosexualitynotok, abortionnotok, euthannotok)))


longus$econleft<-  with(longus, rowMeans(data.frame(incomediffs, econresponsibility, ownershipbusiness, competgood, hardwork, wealthpositive)))

longus$age1s<-with(longus, (ageyears-min(ageyears, na.rm=T))/(max(ageyears, na.rm=T)-min(ageyears, na.rm=T)) )

longus$confinstit<-with(longus, rowMeans(data.frame(confparties, confgov, confparliament)))

longus$poleng<-with(longus, rowMeans(data.frame(politint, politimp)))


longus$cultrightplussd<-with(longus, cultright-(mean(cultright, na.rm=T)+sd(cultright, na.rm=T)))

longus$cultrightminussd<-with(longus, cultright-(mean(cultright, na.rm=T)-sd(cultright, na.rm=T)))

longus$econleftplussd<-with(longus, econleft-(mean(econleft, na.rm=T)+sd(econleft, na.rm=T)))

longus$econleftminussd<-with(longus, econleft-(mean(econleft, na.rm=T)-sd(econleft, na.rm=T)))


longus$cultrightscl<-with(longus, (cultright-mean(cultright, na.rm=T))/(2*sd(cultright, na.rm=T)))

longus$econleftscl<-with(longus, (econleft-mean(econleft, na.rm=T))/(2*sd(econleft, na.rm=T)))


longus$age1sscl<-with(longus, (age1s-mean(age1s, na.rm=T))/(2*sd(age1s, na.rm=T)))


longus$confinstitscl<-with(longus, (confinstit-mean(confinstit, na.rm=T))/(2*sd(confinstit, na.rm=T)))


longus$polengscl<-with(longus, (poleng-mean(poleng, na.rm=T))/(2*sd(poleng, na.rm=T)))


longus$hhincdecilescl<-with(longus, (hhincdecile-mean(hhincdecile, na.rm=T))/(2*sd(hhincdecile, na.rm=T)))


longus$finansatscl<-with(longus, (finansat-mean(finansat, na.rm=T))/(2*sd(finansat, na.rm=T)))

longus$econextrem<-abs(with(longus, (econleft-mean(econleft, na.rm=T))))

longus$econextremscl<-with(longus, (econextrem-mean(econextrem, na.rm=T))/(2*sd(econextrem, na.rm=T)))


usi2 <- as.mids(longus)

usdatlist <- miceadds::mids2datlist(usi2)

usreg1<- with(usdatlist,lm(authgov3i~cultrightscl+econleftscl, weights = S017))

usreg2<- with(usdatlist,lm(authgov3i~cultrightscl+econleftscl+cultrightscl:econleftscl, weights = S017))


usreg3<- with(usdatlist,lm(authgov3i~cultrightscl+econleftscl+sex+age1sscl+collegedegree+hhincdecilescl+confinstitscl+polengscl+finansatscl, weights = S017))


usreg4<- with(usdatlist,lm(authgov3i~cultrightscl+econleftscl+sex+age1sscl+collegedegree+hhincdecilescl+confinstitscl+polengscl+finansatscl+cultrightscl:econleftscl, weights = S017))





usregright<- with(usdatlist,lm(authgov3i~cultrightplussd+econleftminussd+cultrightplussd:econleftminussd, weights = S017))


usregleft<- with(usdatlist,lm(authgov3i~cultrightminussd+econleftplussd+cultrightminussd:econleftplussd, weights = S017))


usregprot<- with(usdatlist,lm(authgov3i~cultrightplussd+econleftplussd+cultrightplussd:econleftplussd, weights = S017))


usregfree<- with(usdatlist,lm(authgov3i~cultrightminussd+econleftminussd+cultrightminussd:econleftminussd, weights = S017))




uscultb <- extract.cis(usreg1)[2,1]
uscultlower <- extract.cis(usreg1)[2,5]
uscultupper <-extract.cis(usreg1)[2,6]

useconb <- extract.cis(usreg1)[3,1]
useconlower <- extract.cis(usreg1)[3,5]
useconupper <-extract.cis(usreg1)[3,6]


usintb <- extract.cis(usreg2)[4,1]
usintlower <- extract.cis(usreg2)[4,5]
usintupper <-extract.cis(usreg2)[4,6]

usrightest<-extract.cis(usregright)[1,1]
usrightlower<-extract.cis(usregright)[1,5]
usrightupper<-extract.cis(usregright)[1,6]

usleftest<-extract.cis(usregleft)[1,1]
usleftlower<-extract.cis(usregleft)[1,5]
usleftupper<-extract.cis(usregleft)[1,6]

usprotest<-extract.cis(usregprot)[1,1]
usprotlower<-extract.cis(usregprot)[1,5]
usprotupper<-extract.cis(usregprot)[1,6]

usfreeest<-extract.cis(usregfree)[1,1]
usfreelower<-extract.cis(usregfree)[1,5]
usfreeupper<-extract.cis(usregfree)[1,6]



uscultb3<-extract.cis(usreg3)[2,1]
uspolengb3<-extract.cis(usreg3)[9,1]
usageb3<-extract.cis(usreg3)[5,1]
uscollegeb3<-extract.cis(usreg3)[6,1]
usconfinstitb3<-extract.cis(usreg3)[8,1]



usout1 <- extract.df(usreg1)
usout2 <- extract.df(usreg2)
usout3 <- extract.df(usreg3)
usout4 <- extract.df(usreg4)


htmlreg(list(usout1,usout2,usout3,usout4), digits = 3,file = "UnitedStatesWVS.table.html",custom.coef.names = c("Constant","Cultural Conservatism","Left Economic Attitudes","Cultural Conservatism x Left Economic Attitudes","Female","Age","College Degree","Household Income", "Confidence in Institutions","Political Engagement","Financial Satisfaction"),caption.above = T,caption = "Table D-14: Predictors of Openness to Authoritarain Governance in United States WVS Dataset",custom.note = ("%stars. <br> Continuous predictors are mean-centered and scaled by two standard deviations. Binary predictors are coded 0-1.<br>The outcome variable is coded to range from 0.0 to 1.0<br> Missing data were replaced using multiple imputation with results pooled across 20 copies of the dataset."),custom.gof.names = c("R<sup>2</sup>","Observations"))



#ancillary analyses with 4-item openness to authoritarian governance measure.  Part E of SOM

#Australia

aus4reg1<- with(ausdatlist,lm(authgov4i~cultrightscl+econleftscl, weights = S017))

aus4reg2<- with(ausdatlist,lm(authgov4i~cultrightscl+econleftscl+cultrightscl:econleftscl, weights = S017))


aus4regright<- with(ausdatlist,lm(authgov4i~cultrightplussd+econleftminussd+cultrightplussd:econleftminussd, weights = S017))

aus4regleft<- with(ausdatlist,lm(authgov4i~cultrightminussd+econleftplussd+cultrightminussd:econleftplussd, weights = S017))

aus4regprot<- with(ausdatlist,lm(authgov4i~cultrightplussd+econleftplussd+cultrightplussd:econleftplussd, weights = S017))

aus4regfree<- with(ausdatlist,lm(authgov4i~cultrightminussd+econleftminussd+cultrightminussd:econleftminussd, weights = S017))





aus4cultb <- extract.cis(aus4reg1)[2,1]
aus4cultlower <- extract.cis(aus4reg1)[2,5]
aus4cultupper <-extract.cis(aus4reg1)[2,6]

aus4econb <- extract.cis(aus4reg1)[3,1]
aus4econlower <- extract.cis(aus4reg1)[3,5]
aus4econupper <-extract.cis(aus4reg1)[3,6]


aus4intb <- extract.cis(aus4reg2)[4,1]
aus4intlower <- extract.cis(aus4reg2)[4,5]
aus4intupper <-extract.cis(aus4reg2)[4,6]

aus4rightest<-extract.cis(aus4regright)[1,1]
aus4rightlower<-extract.cis(aus4regright)[1,5]
aus4rightupper<-extract.cis(aus4regright)[1,6]

aus4leftest<-extract.cis(aus4regleft)[1,1]
aus4leftlower<-extract.cis(aus4regleft)[1,5]
aus4leftupper<-extract.cis(aus4regleft)[1,6]

aus4protest<-extract.cis(aus4regprot)[1,1]
aus4protlower<-extract.cis(aus4regprot)[1,5]
aus4protupper<-extract.cis(aus4regprot)[1,6]

aus4freeest<-extract.cis(aus4regfree)[1,1]
aus4freelower<-extract.cis(aus4regfree)[1,5]
aus4freeupper<-extract.cis(aus4regfree)[1,6]



#Canada

can4reg1<- with(candatlist,lm(authgov4i~cultrightscl+econleftscl, weights = S017))

can4reg2<- with(candatlist,lm(authgov4i~cultrightscl+econleftscl+cultrightscl:econleftscl, weights = S017))



can4regright<- with(candatlist,lm(authgov4i~cultrightplussd+econleftminussd+cultrightplussd:econleftminussd, weights = S017))

can4regleft<- with(candatlist,lm(authgov4i~cultrightminussd+econleftplussd+cultrightminussd:econleftplussd, weights = S017))

can4regprot<- with(candatlist,lm(authgov4i~cultrightplussd+econleftplussd+cultrightplussd:econleftplussd, weights = S017))

can4regfree<- with(candatlist,lm(authgov4i~cultrightminussd+econleftminussd+cultrightminussd:econleftminussd, weights = S017))





can4cultb <- extract.cis(can4reg1)[2,1]
can4cultlower <- extract.cis(can4reg1)[2,5]
can4cultupper <-extract.cis(can4reg1)[2,6]

can4econb <- extract.cis(can4reg1)[3,1]
can4econlower <- extract.cis(can4reg1)[3,5]
can4econupper <-extract.cis(can4reg1)[3,6]


can4intb <- extract.cis(can4reg2)[4,1]
can4intlower <- extract.cis(can4reg2)[4,5]
can4intupper <-extract.cis(can4reg2)[4,6]

can4rightest<-extract.cis(can4regright)[1,1]
can4rightlower<-extract.cis(can4regright)[1,5]
can4rightupper<-extract.cis(can4regright)[1,6]

can4leftest<-extract.cis(can4regleft)[1,1]
can4leftlower<-extract.cis(can4regleft)[1,5]
can4leftupper<-extract.cis(can4regleft)[1,6]

can4protest<-extract.cis(can4regprot)[1,1]
can4protlower<-extract.cis(can4regprot)[1,5]
can4protupper<-extract.cis(can4regprot)[1,6]

can4freeest<-extract.cis(can4regfree)[1,1]
can4freelower<-extract.cis(can4regfree)[1,5]
can4freeupper<-extract.cis(can4regfree)[1,6]

#Finland

fin4reg1<- with(findatlist,lm(authgov4i~cultrightscl+econleftscl, weights = S017))

fin4reg2<- with(findatlist,lm(authgov4i~cultrightscl+econleftscl+cultrightscl:econleftscl, weights = S017))



fin4regright<- with(findatlist,lm(authgov4i~cultrightplussd+econleftminussd+cultrightplussd:econleftminussd, weights = S017))

fin4regleft<- with(findatlist,lm(authgov4i~cultrightminussd+econleftplussd+cultrightminussd:econleftplussd, weights = S017))

fin4regprot<- with(findatlist,lm(authgov4i~cultrightplussd+econleftplussd+cultrightplussd:econleftplussd, weights = S017))

fin4regfree<- with(findatlist,lm(authgov4i~cultrightminussd+econleftminussd+cultrightminussd:econleftminussd, weights = S017))





fin4cultb <- extract.cis(fin4reg1)[2,1]
fin4cultlower <- extract.cis(fin4reg1)[2,5]
fin4cultupper <-extract.cis(fin4reg1)[2,6]

fin4econb <- extract.cis(fin4reg1)[3,1]
fin4econlower <- extract.cis(fin4reg1)[3,5]
fin4econupper <-extract.cis(fin4reg1)[3,6]


fin4intb <- extract.cis(fin4reg2)[4,1]
fin4intlower <- extract.cis(fin4reg2)[4,5]
fin4intupper <-extract.cis(fin4reg2)[4,6]

fin4rightest<-extract.cis(fin4regright)[1,1]
fin4rightlower<-extract.cis(fin4regright)[1,5]
fin4rightupper<-extract.cis(fin4regright)[1,6]

fin4leftest<-extract.cis(fin4regleft)[1,1]
fin4leftlower<-extract.cis(fin4regleft)[1,5]
fin4leftupper<-extract.cis(fin4regleft)[1,6]

fin4protest<-extract.cis(fin4regprot)[1,1]
fin4protlower<-extract.cis(fin4regprot)[1,5]
fin4protupper<-extract.cis(fin4regprot)[1,6]

fin4freeest<-extract.cis(fin4regfree)[1,1]
fin4freelower<-extract.cis(fin4regfree)[1,5]
fin4freeupper<-extract.cis(fin4regfree)[1,6]


#France

fra4reg1<- with(fradatlist,lm(authgov4i~cultrightscl+econleftscl, weights = S017))

fra4reg2<- with(fradatlist,lm(authgov4i~cultrightscl+econleftscl+cultrightscl:econleftscl, weights = S017))


fra4regright<- with(fradatlist,lm(authgov4i~cultrightplussd+econleftminussd+cultrightplussd:econleftminussd, weights = S017))

fra4regleft<- with(fradatlist,lm(authgov4i~cultrightminussd+econleftplussd+cultrightminussd:econleftplussd, weights = S017))

fra4regprot<- with(fradatlist,lm(authgov4i~cultrightplussd+econleftplussd+cultrightplussd:econleftplussd, weights = S017))

fra4regfree<- with(fradatlist,lm(authgov4i~cultrightminussd+econleftminussd+cultrightminussd:econleftminussd, weights = S017))





fra4cultb <- extract.cis(fra4reg1)[2,1]
fra4cultlower <- extract.cis(fra4reg1)[2,5]
fra4cultupper <-extract.cis(fra4reg1)[2,6]

fra4econb <- extract.cis(fra4reg1)[3,1]
fra4econlower <- extract.cis(fra4reg1)[3,5]
fra4econupper <-extract.cis(fra4reg1)[3,6]


fra4intb <- extract.cis(fra4reg2)[4,1]
fra4intlower <- extract.cis(fra4reg2)[4,5]
fra4intupper <-extract.cis(fra4reg2)[4,6]

fra4rightest<-extract.cis(fra4regright)[1,1]
fra4rightlower<-extract.cis(fra4regright)[1,5]
fra4rightupper<-extract.cis(fra4regright)[1,6]

fra4leftest<-extract.cis(fra4regleft)[1,1]
fra4leftlower<-extract.cis(fra4regleft)[1,5]
fra4leftupper<-extract.cis(fra4regleft)[1,6]

fra4protest<-extract.cis(fra4regprot)[1,1]
fra4protlower<-extract.cis(fra4regprot)[1,5]
fra4protupper<-extract.cis(fra4regprot)[1,6]

fra4freeest<-extract.cis(fra4regfree)[1,1]
fra4freelower<-extract.cis(fra4regfree)[1,5]
fra4freeupper<-extract.cis(fra4regfree)[1,6]


#WVS Germany


ger4reg1<- with(gerdatlist,lm(authgov4i~cultrightscl+econleftscl, weights = S017))

ger4reg2<- with(gerdatlist,lm(authgov4i~cultrightscl+econleftscl+cultrightscl:econleftscl, weights = S017))


ger4regright<- with(gerdatlist,lm(authgov4i~cultrightplussd+econleftminussd+cultrightplussd:econleftminussd, weights = S017))

ger4regleft<- with(gerdatlist,lm(authgov4i~cultrightminussd+econleftplussd+cultrightminussd:econleftplussd, weights = S017))

ger4regprot<- with(gerdatlist,lm(authgov4i~cultrightplussd+econleftplussd+cultrightplussd:econleftplussd, weights = S017))

ger4regfree<- with(gerdatlist,lm(authgov4i~cultrightminussd+econleftminussd+cultrightminussd:econleftminussd, weights = S017))





ger4cultb <- extract.cis(ger4reg1)[2,1]
ger4cultlower <- extract.cis(ger4reg1)[2,5]
ger4cultupper <-extract.cis(ger4reg1)[2,6]

ger4econb <- extract.cis(ger4reg1)[3,1]
ger4econlower <- extract.cis(ger4reg1)[3,5]
ger4econupper <-extract.cis(ger4reg1)[3,6]


ger4intb <- extract.cis(ger4reg2)[4,1]
ger4intlower <- extract.cis(ger4reg2)[4,5]
ger4intupper <-extract.cis(ger4reg2)[4,6]

ger4rightest<-extract.cis(ger4regright)[1,1]
ger4rightlower<-extract.cis(ger4regright)[1,5]
ger4rightupper<-extract.cis(ger4regright)[1,6]

ger4leftest<-extract.cis(ger4regleft)[1,1]
ger4leftlower<-extract.cis(ger4regleft)[1,5]
ger4leftupper<-extract.cis(ger4regleft)[1,6]

ger4protest<-extract.cis(ger4regprot)[1,1]
ger4protlower<-extract.cis(ger4regprot)[1,5]
ger4protupper<-extract.cis(ger4regprot)[1,6]

ger4freeest<-extract.cis(ger4regfree)[1,1]
ger4freelower<-extract.cis(ger4regfree)[1,5]
ger4freeupper<-extract.cis(ger4regfree)[1,6]

#Great Britain

gb4reg1<- with(gbdatlist,lm(authgov4i~cultrightscl+econleftscl, weights = S017))

gb4reg2<- with(gbdatlist,lm(authgov4i~cultrightscl+econleftscl+cultrightscl:econleftscl, weights = S017))


gb4regright<- with(gbdatlist,lm(authgov4i~cultrightplussd+econleftminussd+cultrightplussd:econleftminussd, weights = S017))

gb4regleft<- with(gbdatlist,lm(authgov4i~cultrightminussd+econleftplussd+cultrightminussd:econleftplussd, weights = S017))

gb4regprot<- with(gbdatlist,lm(authgov4i~cultrightplussd+econleftplussd+cultrightplussd:econleftplussd, weights = S017))

gb4regfree<- with(gbdatlist,lm(authgov4i~cultrightminussd+econleftminussd+cultrightminussd:econleftminussd, weights = S017))





gb4cultb <- extract.cis(gb4reg1)[2,1]
gb4cultlower <- extract.cis(gb4reg1)[2,5]
gb4cultupper <-extract.cis(gb4reg1)[2,6]

gb4econb <- extract.cis(gb4reg1)[3,1]
gb4econlower <- extract.cis(gb4reg1)[3,5]
gb4econupper <-extract.cis(gb4reg1)[3,6]


gb4intb <- extract.cis(gb4reg2)[4,1]
gb4intlower <- extract.cis(gb4reg2)[4,5]
gb4intupper <-extract.cis(gb4reg2)[4,6]

gb4rightest<-extract.cis(gb4regright)[1,1]
gb4rightlower<-extract.cis(gb4regright)[1,5]
gb4rightupper<-extract.cis(gb4regright)[1,6]

gb4leftest<-extract.cis(gb4regleft)[1,1]
gb4leftlower<-extract.cis(gb4regleft)[1,5]
gb4leftupper<-extract.cis(gb4regleft)[1,6]

gb4protest<-extract.cis(gb4regprot)[1,1]
gb4protlower<-extract.cis(gb4regprot)[1,5]
gb4protupper<-extract.cis(gb4regprot)[1,6]

gb4freeest<-extract.cis(gb4regfree)[1,1]
gb4freelower<-extract.cis(gb4regfree)[1,5]
gb4freeupper<-extract.cis(gb4regfree)[1,6]

#Italy


ita4reg1<- with(itadatlist,lm(authgov4i~cultrightscl+econleftscl, weights = S017))

ita4reg2<- with(itadatlist,lm(authgov4i~cultrightscl+econleftscl+cultrightscl:econleftscl, weights = S017))


ita4regright<- with(itadatlist,lm(authgov4i~cultrightplussd+econleftminussd+cultrightplussd:econleftminussd, weights = S017))

ita4regleft<- with(itadatlist,lm(authgov4i~cultrightminussd+econleftplussd+cultrightminussd:econleftplussd, weights = S017))

ita4regprot<- with(itadatlist,lm(authgov4i~cultrightplussd+econleftplussd+cultrightplussd:econleftplussd, weights = S017))

ita4regfree<- with(itadatlist,lm(authgov4i~cultrightminussd+econleftminussd+cultrightminussd:econleftminussd, weights = S017))





ita4cultb <- extract.cis(ita4reg1)[2,1]
ita4cultlower <- extract.cis(ita4reg1)[2,5]
ita4cultupper <-extract.cis(ita4reg1)[2,6]

ita4econb <- extract.cis(ita4reg1)[3,1]
ita4econlower <- extract.cis(ita4reg1)[3,5]
ita4econupper <-extract.cis(ita4reg1)[3,6]


ita4intb <- extract.cis(ita4reg2)[4,1]
ita4intlower <- extract.cis(ita4reg2)[4,5]
ita4intupper <-extract.cis(ita4reg2)[4,6]

ita4rightest<-extract.cis(ita4regright)[1,1]
ita4rightlower<-extract.cis(ita4regright)[1,5]
ita4rightupper<-extract.cis(ita4regright)[1,6]

ita4leftest<-extract.cis(ita4regleft)[1,1]
ita4leftlower<-extract.cis(ita4regleft)[1,5]
ita4leftupper<-extract.cis(ita4regleft)[1,6]

ita4protest<-extract.cis(ita4regprot)[1,1]
ita4protlower<-extract.cis(ita4regprot)[1,5]
ita4protupper<-extract.cis(ita4regprot)[1,6]

ita4freeest<-extract.cis(ita4regfree)[1,1]
ita4freelower<-extract.cis(ita4regfree)[1,5]
ita4freeupper<-extract.cis(ita4regfree)[1,6]

#Netherlands


nth4reg1<- with(nthdatlist,lm(authgov4i~cultrightscl+econleftscl, weights = S017))

nth4reg2<- with(nthdatlist,lm(authgov4i~cultrightscl+econleftscl+cultrightscl:econleftscl, weights = S017))


nth4regright<- with(nthdatlist,lm(authgov4i~cultrightplussd+econleftminussd+cultrightplussd:econleftminussd, weights = S017))

nth4regleft<- with(nthdatlist,lm(authgov4i~cultrightminussd+econleftplussd+cultrightminussd:econleftplussd, weights = S017))

nth4regprot<- with(nthdatlist,lm(authgov4i~cultrightplussd+econleftplussd+cultrightplussd:econleftplussd, weights = S017))

nth4regfree<- with(nthdatlist,lm(authgov4i~cultrightminussd+econleftminussd+cultrightminussd:econleftminussd, weights = S017))





nth4cultb <- extract.cis(nth4reg1)[2,1]
nth4cultlower <- extract.cis(nth4reg1)[2,5]
nth4cultupper <-extract.cis(nth4reg1)[2,6]

nth4econb <- extract.cis(nth4reg1)[3,1]
nth4econlower <- extract.cis(nth4reg1)[3,5]
nth4econupper <-extract.cis(nth4reg1)[3,6]


nth4intb <- extract.cis(nth4reg2)[4,1]
nth4intlower <- extract.cis(nth4reg2)[4,5]
nth4intupper <-extract.cis(nth4reg2)[4,6]

nth4rightest<-extract.cis(nth4regright)[1,1]
nth4rightlower<-extract.cis(nth4regright)[1,5]
nth4rightupper<-extract.cis(nth4regright)[1,6]

nth4leftest<-extract.cis(nth4regleft)[1,1]
nth4leftlower<-extract.cis(nth4regleft)[1,5]
nth4leftupper<-extract.cis(nth4regleft)[1,6]

nth4protest<-extract.cis(nth4regprot)[1,1]
nth4protlower<-extract.cis(nth4regprot)[1,5]
nth4protupper<-extract.cis(nth4regprot)[1,6]

nth4freeest<-extract.cis(nth4regfree)[1,1]
nth4freelower<-extract.cis(nth4regfree)[1,5]
nth4freeupper<-extract.cis(nth4regfree)[1,6]

#New Zealand


nz4reg1<- with(nzdatlist,lm(authgov4i~cultrightscl+econleftscl, weights = S017))

nz4reg2<- with(nzdatlist,lm(authgov4i~cultrightscl+econleftscl+cultrightscl:econleftscl, weights = S017))


nz4regright<- with(nzdatlist,lm(authgov4i~cultrightplussd+econleftminussd+cultrightplussd:econleftminussd, weights = S017))

nz4regleft<- with(nzdatlist,lm(authgov4i~cultrightminussd+econleftplussd+cultrightminussd:econleftplussd, weights = S017))

nz4regprot<- with(nzdatlist,lm(authgov4i~cultrightplussd+econleftplussd+cultrightplussd:econleftplussd, weights = S017))

nz4regfree<- with(nzdatlist,lm(authgov4i~cultrightminussd+econleftminussd+cultrightminussd:econleftminussd, weights = S017))





nz4cultb <- extract.cis(nz4reg1)[2,1]
nz4cultlower <- extract.cis(nz4reg1)[2,5]
nz4cultupper <-extract.cis(nz4reg1)[2,6]

nz4econb <- extract.cis(nz4reg1)[3,1]
nz4econlower <- extract.cis(nz4reg1)[3,5]
nz4econupper <-extract.cis(nz4reg1)[3,6]


nz4intb <- extract.cis(nz4reg2)[4,1]
nz4intlower <- extract.cis(nz4reg2)[4,5]
nz4intupper <-extract.cis(nz4reg2)[4,6]

nz4rightest<-extract.cis(nz4regright)[1,1]
nz4rightlower<-extract.cis(nz4regright)[1,5]
nz4rightupper<-extract.cis(nz4regright)[1,6]

nz4leftest<-extract.cis(nz4regleft)[1,1]
nz4leftlower<-extract.cis(nz4regleft)[1,5]
nz4leftupper<-extract.cis(nz4regleft)[1,6]

nz4protest<-extract.cis(nz4regprot)[1,1]
nz4protlower<-extract.cis(nz4regprot)[1,5]
nz4protupper<-extract.cis(nz4regprot)[1,6]

nz4freeest<-extract.cis(nz4regfree)[1,1]
nz4freelower<-extract.cis(nz4regfree)[1,5]
nz4freeupper<-extract.cis(nz4regfree)[1,6]


#Norway


nor4reg1<- with(nordatlist,lm(authgov4i~cultrightscl+econleftscl, weights = S017))

nor4reg2<- with(nordatlist,lm(authgov4i~cultrightscl+econleftscl+cultrightscl:econleftscl, weights = S017))


nor4regright<- with(nordatlist,lm(authgov4i~cultrightplussd+econleftminussd+cultrightplussd:econleftminussd, weights = S017))

nor4regleft<- with(nordatlist,lm(authgov4i~cultrightminussd+econleftplussd+cultrightminussd:econleftplussd, weights = S017))

nor4regprot<- with(nordatlist,lm(authgov4i~cultrightplussd+econleftplussd+cultrightplussd:econleftplussd, weights = S017))

nor4regfree<- with(nordatlist,lm(authgov4i~cultrightminussd+econleftminussd+cultrightminussd:econleftminussd, weights = S017))





nor4cultb <- extract.cis(nor4reg1)[2,1]
nor4cultlower <- extract.cis(nor4reg1)[2,5]
nor4cultupper <-extract.cis(nor4reg1)[2,6]

nor4econb <- extract.cis(nor4reg1)[3,1]
nor4econlower <- extract.cis(nor4reg1)[3,5]
nor4econupper <-extract.cis(nor4reg1)[3,6]


nor4intb <- extract.cis(nor4reg2)[4,1]
nor4intlower <- extract.cis(nor4reg2)[4,5]
nor4intupper <-extract.cis(nor4reg2)[4,6]

nor4rightest<-extract.cis(nor4regright)[1,1]
nor4rightlower<-extract.cis(nor4regright)[1,5]
nor4rightupper<-extract.cis(nor4regright)[1,6]

nor4leftest<-extract.cis(nor4regleft)[1,1]
nor4leftlower<-extract.cis(nor4regleft)[1,5]
nor4leftupper<-extract.cis(nor4regleft)[1,6]

nor4protest<-extract.cis(nor4regprot)[1,1]
nor4protlower<-extract.cis(nor4regprot)[1,5]
nor4protupper<-extract.cis(nor4regprot)[1,6]

nor4freeest<-extract.cis(nor4regfree)[1,1]
nor4freelower<-extract.cis(nor4regfree)[1,5]
nor4freeupper<-extract.cis(nor4regfree)[1,6]


#Spain


spn4reg1<- with(spndatlist,lm(authgov4i~cultrightscl+econleftscl, weights = S017))

spn4reg2<- with(spndatlist,lm(authgov4i~cultrightscl+econleftscl+cultrightscl:econleftscl, weights = S017))


spn4regright<- with(spndatlist,lm(authgov4i~cultrightplussd+econleftminussd+cultrightplussd:econleftminussd, weights = S017))

spn4regleft<- with(spndatlist,lm(authgov4i~cultrightminussd+econleftplussd+cultrightminussd:econleftplussd, weights = S017))

spn4regprot<- with(spndatlist,lm(authgov4i~cultrightplussd+econleftplussd+cultrightplussd:econleftplussd, weights = S017))

spn4regfree<- with(spndatlist,lm(authgov4i~cultrightminussd+econleftminussd+cultrightminussd:econleftminussd, weights = S017))





spn4cultb <- extract.cis(spn4reg1)[2,1]
spn4cultlower <- extract.cis(spn4reg1)[2,5]
spn4cultupper <-extract.cis(spn4reg1)[2,6]

spn4econb <- extract.cis(spn4reg1)[3,1]
spn4econlower <- extract.cis(spn4reg1)[3,5]
spn4econupper <-extract.cis(spn4reg1)[3,6]


spn4intb <- extract.cis(spn4reg2)[4,1]
spn4intlower <- extract.cis(spn4reg2)[4,5]
spn4intupper <-extract.cis(spn4reg2)[4,6]

spn4rightest<-extract.cis(spn4regright)[1,1]
spn4rightlower<-extract.cis(spn4regright)[1,5]
spn4rightupper<-extract.cis(spn4regright)[1,6]

spn4leftest<-extract.cis(spn4regleft)[1,1]
spn4leftlower<-extract.cis(spn4regleft)[1,5]
spn4leftupper<-extract.cis(spn4regleft)[1,6]

spn4protest<-extract.cis(spn4regprot)[1,1]
spn4protlower<-extract.cis(spn4regprot)[1,5]
spn4protupper<-extract.cis(spn4regprot)[1,6]

spn4freeest<-extract.cis(spn4regfree)[1,1]
spn4freelower<-extract.cis(spn4regfree)[1,5]
spn4freeupper<-extract.cis(spn4regfree)[1,6]


#Sweden


swe4reg1<- with(swedatlist,lm(authgov4i~cultrightscl+econleftscl, weights = S017))

swe4reg2<- with(swedatlist,lm(authgov4i~cultrightscl+econleftscl+cultrightscl:econleftscl, weights = S017))


swe4regright<- with(swedatlist,lm(authgov4i~cultrightplussd+econleftminussd+cultrightplussd:econleftminussd, weights = S017))

swe4regleft<- with(swedatlist,lm(authgov4i~cultrightminussd+econleftplussd+cultrightminussd:econleftplussd, weights = S017))

swe4regprot<- with(swedatlist,lm(authgov4i~cultrightplussd+econleftplussd+cultrightplussd:econleftplussd, weights = S017))

swe4regfree<- with(swedatlist,lm(authgov4i~cultrightminussd+econleftminussd+cultrightminussd:econleftminussd, weights = S017))





swe4cultb <- extract.cis(swe4reg1)[2,1]
swe4cultlower <- extract.cis(swe4reg1)[2,5]
swe4cultupper <-extract.cis(swe4reg1)[2,6]

swe4econb <- extract.cis(swe4reg1)[3,1]
swe4econlower <- extract.cis(swe4reg1)[3,5]
swe4econupper <-extract.cis(swe4reg1)[3,6]


swe4intb <- extract.cis(swe4reg2)[4,1]
swe4intlower <- extract.cis(swe4reg2)[4,5]
swe4intupper <-extract.cis(swe4reg2)[4,6]

swe4rightest<-extract.cis(swe4regright)[1,1]
swe4rightlower<-extract.cis(swe4regright)[1,5]
swe4rightupper<-extract.cis(swe4regright)[1,6]

swe4leftest<-extract.cis(swe4regleft)[1,1]
swe4leftlower<-extract.cis(swe4regleft)[1,5]
swe4leftupper<-extract.cis(swe4regleft)[1,6]

swe4protest<-extract.cis(swe4regprot)[1,1]
swe4protlower<-extract.cis(swe4regprot)[1,5]
swe4protupper<-extract.cis(swe4regprot)[1,6]

swe4freeest<-extract.cis(swe4regfree)[1,1]
swe4freelower<-extract.cis(swe4regfree)[1,5]
swe4freeupper<-extract.cis(swe4regfree)[1,6]

#Switzerland


swi4reg1<- with(swidatlist,lm(authgov4i~cultrightscl+econleftscl, weights = S017))

swi4reg2<- with(swidatlist,lm(authgov4i~cultrightscl+econleftscl+cultrightscl:econleftscl, weights = S017))


swi4regright<- with(swidatlist,lm(authgov4i~cultrightplussd+econleftminussd+cultrightplussd:econleftminussd, weights = S017))

swi4regleft<- with(swidatlist,lm(authgov4i~cultrightminussd+econleftplussd+cultrightminussd:econleftplussd, weights = S017))

swi4regprot<- with(swidatlist,lm(authgov4i~cultrightplussd+econleftplussd+cultrightplussd:econleftplussd, weights = S017))

swi4regfree<- with(swidatlist,lm(authgov4i~cultrightminussd+econleftminussd+cultrightminussd:econleftminussd, weights = S017))





swi4cultb <- extract.cis(swi4reg1)[2,1]
swi4cultlower <- extract.cis(swi4reg1)[2,5]
swi4cultupper <-extract.cis(swi4reg1)[2,6]

swi4econb <- extract.cis(swi4reg1)[3,1]
swi4econlower <- extract.cis(swi4reg1)[3,5]
swi4econupper <-extract.cis(swi4reg1)[3,6]


swi4intb <- extract.cis(swi4reg2)[4,1]
swi4intlower <- extract.cis(swi4reg2)[4,5]
swi4intupper <-extract.cis(swi4reg2)[4,6]

swi4rightest<-extract.cis(swi4regright)[1,1]
swi4rightlower<-extract.cis(swi4regright)[1,5]
swi4rightupper<-extract.cis(swi4regright)[1,6]

swi4leftest<-extract.cis(swi4regleft)[1,1]
swi4leftlower<-extract.cis(swi4regleft)[1,5]
swi4leftupper<-extract.cis(swi4regleft)[1,6]

swi4protest<-extract.cis(swi4regprot)[1,1]
swi4protlower<-extract.cis(swi4regprot)[1,5]
swi4protupper<-extract.cis(swi4regprot)[1,6]

swi4freeest<-extract.cis(swi4regfree)[1,1]
swi4freelower<-extract.cis(swi4regfree)[1,5]
swi4freeupper<-extract.cis(swi4regfree)[1,6]

#United States


us4reg1<- with(usdatlist,lm(authgov4i~cultrightscl+econleftscl, weights = S017))

us4reg2<- with(usdatlist,lm(authgov4i~cultrightscl+econleftscl+cultrightscl:econleftscl, weights = S017))




us4regright<- with(usdatlist,lm(authgov4i~cultrightplussd+econleftminussd+cultrightplussd:econleftminussd, weights = S017))

us4regleft<- with(usdatlist,lm(authgov4i~cultrightminussd+econleftplussd+cultrightminussd:econleftplussd, weights = S017))

us4regprot<- with(usdatlist,lm(authgov4i~cultrightplussd+econleftplussd+cultrightplussd:econleftplussd, weights = S017))

us4regfree<- with(usdatlist,lm(authgov4i~cultrightminussd+econleftminussd+cultrightminussd:econleftminussd, weights = S017))





us4cultb <- extract.cis(us4reg1)[2,1]
us4cultlower <- extract.cis(us4reg1)[2,5]
us4cultupper <-extract.cis(us4reg1)[2,6]

us4econb <- extract.cis(us4reg1)[3,1]
us4econlower <- extract.cis(us4reg1)[3,5]
us4econupper <-extract.cis(us4reg1)[3,6]


us4intb <- extract.cis(us4reg2)[4,1]
us4intlower <- extract.cis(us4reg2)[4,5]
us4intupper <-extract.cis(us4reg2)[4,6]

us4rightest<-extract.cis(us4regright)[1,1]
us4rightlower<-extract.cis(us4regright)[1,5]
us4rightupper<-extract.cis(us4regright)[1,6]

us4leftest<-extract.cis(us4regleft)[1,1]
us4leftlower<-extract.cis(us4regleft)[1,5]
us4leftupper<-extract.cis(us4regleft)[1,6]

us4protest<-extract.cis(us4regprot)[1,1]
us4protlower<-extract.cis(us4regprot)[1,5]
us4protupper<-extract.cis(us4regprot)[1,6]

us4freeest<-extract.cis(us4regfree)[1,1]
us4freelower<-extract.cis(us4regfree)[1,5]
us4freeupper<-extract.cis(us4regfree)[1,6]





###############################################################


#analyses without imputation, using composites with all available items and listwise exclusion. Reported in Part E of SOM

#Australia

ausl<-subset(west, subset=(country=='Australia'), select=c(cultright, econleft, authgov3i, S017))

ausl$cultrightscl<-with (ausl, (cultright-mean(cultright, na.rm=T))/(2*sd(cultright, na.rm=T)))

ausl$econleftscl<-with (ausl, (econleft-mean(econleft, na.rm=T))/(2*sd(econleft, na.rm=T)))

reg1ausl<-lm(authgov3i~cultrightscl+econleftscl, weights=S017, data=ausl)

reg2ausl<-lm(authgov3i~cultrightscl+econleftscl+cultrightscl:econleftscl, weights=S017, data=ausl)

auslcultb<-summary(reg1ausl)$coef[2,1]
auslcultlower<-confint(reg1ausl)[2,1]
auslcultupper<-confint(reg1ausl)[2,2]

ausleconb<-summary(reg1ausl)$coef[3,1]
ausleconlower<-confint(reg1ausl)[3,1]
ausleconupper<-confint(reg1ausl)[3,2]

auslintb<-summary(reg2ausl)$coef[4,1]
auslintlower<-confint(reg2ausl)[4,1]
auslintupper<-confint(reg2ausl)[4,2]


ausl$cultrightplussd<-with(ausl, cultright-(mean(cultright, na.rm=T)+sd(cultright, na.rm=T)))

ausl$cultrightminussd<-with(ausl, cultright-(mean(cultright, na.rm=T)-sd(cultright, na.rm=T)))

ausl$econleftplussd<-with(ausl, econleft-(mean(econleft, na.rm=T)+sd(econleft, na.rm=T)))

ausl$econleftminussd<-with(ausl, econleft-(mean(econleft, na.rm=T)-sd(econleft, na.rm=T)))


auslregright<- with(ausl,lm(authgov3i~cultrightplussd+econleftminussd+cultrightplussd:econleftminussd, weights = S017))

auslregleft<- with(ausl,lm(authgov3i~cultrightminussd+econleftplussd+cultrightminussd:econleftplussd, weights = S017))

auslregprot<- with(ausl,lm(authgov3i~cultrightplussd+econleftplussd+cultrightplussd:econleftplussd, weights = S017))

auslregfree<- with(ausl,lm(authgov3i~cultrightminussd+econleftminussd+cultrightminussd:econleftminussd, weights = S017))


auslrightest<-summary(auslregright)$coef[1,1]
auslrightlower<-confint(auslregright)[1,1]
auslrightupper<-confint(auslregright)[1,2]

auslleftest<-summary(auslregleft)$coef[1,1]
auslleftlower<-confint(auslregleft)[1,1]
auslleftupper<-confint(auslregleft)[1,2]

auslprotest<-summary(auslregprot)$coef[1,1]
auslprotlower<-confint(auslregprot)[1,1]
auslprotupper<-confint(auslregprot)[1,2]

auslfreeest<-summary(auslregfree)$coef[1,1]
auslfreelower<-confint(auslregfree)[1,1]
auslfreeupper<-confint(auslregfree)[1,2]

#Canada

canl<-subset(west, subset=(country=='Canada'), select=c(cultright, econleft, authgov3i, S017))

canl$cultrightscl<-with (canl, (cultright-mean(cultright, na.rm=T))/(2*sd(cultright, na.rm=T)))

canl$econleftscl<-with (canl, (econleft-mean(econleft, na.rm=T))/(2*sd(econleft, na.rm=T)))

reg1canl<-lm(authgov3i~cultrightscl+econleftscl, weights=S017, data=canl)

reg2canl<-lm(authgov3i~cultrightscl+econleftscl+cultrightscl:econleftscl, weights=S017, data=canl)


canlcultb<-summary(reg1canl)$coef[2,1]
canlcultlower<-confint(reg1canl)[2,1]
canlcultupper<-confint(reg1canl)[2,2]

canleconb<-summary(reg1canl)$coef[3,1]
canleconlower<-confint(reg1canl)[3,1]
canleconupper<-confint(reg1canl)[3,2]

canlintb<-summary(reg2canl)$coef[4,1]
canlintlower<-confint(reg2canl)[4,1]
canlintupper<-confint(reg2canl)[4,2]


canl$cultrightplussd<-with(canl, cultright-(mean(cultright, na.rm=T)+sd(cultright, na.rm=T)))

canl$cultrightminussd<-with(canl, cultright-(mean(cultright, na.rm=T)-sd(cultright, na.rm=T)))

canl$econleftplussd<-with(canl, econleft-(mean(econleft, na.rm=T)+sd(econleft, na.rm=T)))

canl$econleftminussd<-with(canl, econleft-(mean(econleft, na.rm=T)-sd(econleft, na.rm=T)))


canlregright<- with(canl,lm(authgov3i~cultrightplussd+econleftminussd+cultrightplussd:econleftminussd, weights = S017))

canlregleft<- with(canl,lm(authgov3i~cultrightminussd+econleftplussd+cultrightminussd:econleftplussd, weights = S017))

canlregprot<- with(canl,lm(authgov3i~cultrightplussd+econleftplussd+cultrightplussd:econleftplussd, weights = S017))

canlregfree<- with(canl,lm(authgov3i~cultrightminussd+econleftminussd+cultrightminussd:econleftminussd, weights = S017))


canlrightest<-summary(canlregright)$coef[1,1]
canlrightlower<-confint(canlregright)[1,1]
canlrightupper<-confint(canlregright)[1,2]

canlleftest<-summary(canlregleft)$coef[1,1]
canlleftlower<-confint(canlregleft)[1,1]
canlleftupper<-confint(canlregleft)[1,2]

canlprotest<-summary(canlregprot)$coef[1,1]
canlprotlower<-confint(canlregprot)[1,1]
canlprotupper<-confint(canlregprot)[1,2]

canlfreeest<-summary(canlregfree)$coef[1,1]
canlfreelower<-confint(canlregfree)[1,1]
canlfreeupper<-confint(canlregfree)[1,2]

#Finland

finl<-subset(west, subset=(country=='Finland'), select=c(cultright, econleft, authgov3i, S017))


finl$cultrightscl<-with (finl, (cultright-mean(cultright, na.rm=T))/(2*sd(cultright, na.rm=T)))

finl$econleftscl<-with (finl, (econleft-mean(econleft, na.rm=T))/(2*sd(econleft, na.rm=T)))

reg1finl<-lm(authgov3i~cultrightscl+econleftscl, weights=S017, data=finl)

reg2finl<-lm(authgov3i~cultrightscl+econleftscl+cultrightscl:econleftscl, weights=S017, data=finl)


finlcultb<-summary(reg1finl)$coef[2,1]
finlcultlower<-confint(reg1finl)[2,1]
finlcultupper<-confint(reg1finl)[2,2]

finleconb<-summary(reg1finl)$coef[3,1]
finleconlower<-confint(reg1finl)[3,1]
finleconupper<-confint(reg1finl)[3,2]

finlintb<-summary(reg2finl)$coef[4,1]
finlintlower<-confint(reg2finl)[4,1]
finlintupper<-confint(reg2finl)[4,2]


finl$cultrightplussd<-with(finl, cultright-(mean(cultright, na.rm=T)+sd(cultright, na.rm=T)))

finl$cultrightminussd<-with(finl, cultright-(mean(cultright, na.rm=T)-sd(cultright, na.rm=T)))

finl$econleftplussd<-with(finl, econleft-(mean(econleft, na.rm=T)+sd(econleft, na.rm=T)))

finl$econleftminussd<-with(finl, econleft-(mean(econleft, na.rm=T)-sd(econleft, na.rm=T)))


finlregright<- with(finl,lm(authgov3i~cultrightplussd+econleftminussd+cultrightplussd:econleftminussd, weights = S017))

finlregleft<- with(finl,lm(authgov3i~cultrightminussd+econleftplussd+cultrightminussd:econleftplussd, weights = S017))

finlregprot<- with(finl,lm(authgov3i~cultrightplussd+econleftplussd+cultrightplussd:econleftplussd, weights = S017))

finlregfree<- with(finl,lm(authgov3i~cultrightminussd+econleftminussd+cultrightminussd:econleftminussd, weights = S017))


finlrightest<-summary(finlregright)$coef[1,1]
finlrightlower<-confint(finlregright)[1,1]
finlrightupper<-confint(finlregright)[1,2]

finlleftest<-summary(finlregleft)$coef[1,1]
finlleftlower<-confint(finlregleft)[1,1]
finlleftupper<-confint(finlregleft)[1,2]

finlprotest<-summary(finlregprot)$coef[1,1]
finlprotlower<-confint(finlregprot)[1,1]
finlprotupper<-confint(finlregprot)[1,2]

finlfreeest<-summary(finlregfree)$coef[1,1]
finlfreelower<-confint(finlregfree)[1,1]
finlfreeupper<-confint(finlregfree)[1,2]

#France

fral<-subset(west, subset=(country=='France'), select=c(cultright, econleft, authgov3i, S017))


fral$cultrightscl<-with (fral, (cultright-mean(cultright, na.rm=T))/(2*sd(cultright, na.rm=T)))

fral$econleftscl<-with (fral, (econleft-mean(econleft, na.rm=T))/(2*sd(econleft, na.rm=T)))

reg1fral<-lm(authgov3i~cultrightscl+econleftscl, weights=S017, data=fral)

reg2fral<-lm(authgov3i~cultrightscl+econleftscl+cultrightscl:econleftscl, weights=S017, data=fral)


fralcultb<-summary(reg1fral)$coef[2,1]
fralcultlower<-confint(reg1fral)[2,1]
fralcultupper<-confint(reg1fral)[2,2]

fraleconb<-summary(reg1fral)$coef[3,1]
fraleconlower<-confint(reg1fral)[3,1]
fraleconupper<-confint(reg1fral)[3,2]

fralintb<-summary(reg2fral)$coef[4,1]
fralintlower<-confint(reg2fral)[4,1]
fralintupper<-confint(reg2fral)[4,2]


fral$cultrightplussd<-with(fral, cultright-(mean(cultright, na.rm=T)+sd(cultright, na.rm=T)))

fral$cultrightminussd<-with(fral, cultright-(mean(cultright, na.rm=T)-sd(cultright, na.rm=T)))

fral$econleftplussd<-with(fral, econleft-(mean(econleft, na.rm=T)+sd(econleft, na.rm=T)))

fral$econleftminussd<-with(fral, econleft-(mean(econleft, na.rm=T)-sd(econleft, na.rm=T)))


fralregright<- with(fral,lm(authgov3i~cultrightplussd+econleftminussd+cultrightplussd:econleftminussd, weights = S017))

fralregleft<- with(fral,lm(authgov3i~cultrightminussd+econleftplussd+cultrightminussd:econleftplussd, weights = S017))

fralregprot<- with(fral,lm(authgov3i~cultrightplussd+econleftplussd+cultrightplussd:econleftplussd, weights = S017))

fralregfree<- with(fral,lm(authgov3i~cultrightminussd+econleftminussd+cultrightminussd:econleftminussd, weights = S017))


fralrightest<-summary(fralregright)$coef[1,1]
fralrightlower<-confint(fralregright)[1,1]
fralrightupper<-confint(fralregright)[1,2]

fralleftest<-summary(fralregleft)$coef[1,1]
fralleftlower<-confint(fralregleft)[1,1]
fralleftupper<-confint(fralregleft)[1,2]

fralprotest<-summary(fralregprot)$coef[1,1]
fralprotlower<-confint(fralregprot)[1,1]
fralprotupper<-confint(fralregprot)[1,2]

fralfreeest<-summary(fralregfree)$coef[1,1]
fralfreelower<-confint(fralregfree)[1,1]
fralfreeupper<-confint(fralregfree)[1,2]


#Germany

gerl<-subset(west, subset=(country=='Germany'), select=c(cultright, econleft, authgov3i, S017))

gerl$cultrightscl<-with (gerl, (cultright-mean(cultright, na.rm=T))/(2*sd(cultright, na.rm=T)))

gerl$econleftscl<-with (gerl, (econleft-mean(econleft, na.rm=T))/(2*sd(econleft, na.rm=T)))

reg1gerl<-lm(authgov3i~cultrightscl+econleftscl, weights=S017, data=gerl)

reg2gerl<-lm(authgov3i~cultrightscl+econleftscl+cultrightscl:econleftscl, weights=S017, data=gerl)


gerlcultb<-summary(reg1gerl)$coef[2,1]
gerlcultlower<-confint(reg1gerl)[2,1]
gerlcultupper<-confint(reg1gerl)[2,2]

gerleconb<-summary(reg1gerl)$coef[3,1]
gerleconlower<-confint(reg1gerl)[3,1]
gerleconupper<-confint(reg1gerl)[3,2]

gerlintb<-summary(reg2gerl)$coef[4,1]
gerlintlower<-confint(reg2gerl)[4,1]
gerlintupper<-confint(reg2gerl)[4,2]


gerl$cultrightplussd<-with(gerl, cultright-(mean(cultright, na.rm=T)+sd(cultright, na.rm=T)))

gerl$cultrightminussd<-with(gerl, cultright-(mean(cultright, na.rm=T)-sd(cultright, na.rm=T)))

gerl$econleftplussd<-with(gerl, econleft-(mean(econleft, na.rm=T)+sd(econleft, na.rm=T)))

gerl$econleftminussd<-with(gerl, econleft-(mean(econleft, na.rm=T)-sd(econleft, na.rm=T)))


gerlregright<- with(gerl,lm(authgov3i~cultrightplussd+econleftminussd+cultrightplussd:econleftminussd, weights = S017))

gerlregleft<- with(gerl,lm(authgov3i~cultrightminussd+econleftplussd+cultrightminussd:econleftplussd, weights = S017))

gerlregprot<- with(gerl,lm(authgov3i~cultrightplussd+econleftplussd+cultrightplussd:econleftplussd, weights = S017))

gerlregfree<- with(gerl,lm(authgov3i~cultrightminussd+econleftminussd+cultrightminussd:econleftminussd, weights = S017))


gerlrightest<-summary(gerlregright)$coef[1,1]
gerlrightlower<-confint(gerlregright)[1,1]
gerlrightupper<-confint(gerlregright)[1,2]

gerlleftest<-summary(gerlregleft)$coef[1,1]
gerlleftlower<-confint(gerlregleft)[1,1]
gerlleftupper<-confint(gerlregleft)[1,2]

gerlprotest<-summary(gerlregprot)$coef[1,1]
gerlprotlower<-confint(gerlregprot)[1,1]
gerlprotupper<-confint(gerlregprot)[1,2]

gerlfreeest<-summary(gerlregfree)$coef[1,1]
gerlfreelower<-confint(gerlregfree)[1,1]
gerlfreeupper<-confint(gerlregfree)[1,2]


#Great Britain

gbl<-subset(west, subset=(country=='Great Britain'), select=c(cultright, econleft, authgov3i, S017))

gbl$cultrightscl<-with (gbl, (cultright-mean(cultright, na.rm=T))/(2*sd(cultright, na.rm=T)))

gbl$econleftscl<-with (gbl, (econleft-mean(econleft, na.rm=T))/(2*sd(econleft, na.rm=T)))

reg1gbl<-lm(authgov3i~cultrightscl+econleftscl, weights=S017, data=gbl)

reg2gbl<-lm(authgov3i~cultrightscl+econleftscl+cultrightscl:econleftscl, weights=S017, data=gbl)


gblcultb<-summary(reg1gbl)$coef[2,1]
gblcultlower<-confint(reg1gbl)[2,1]
gblcultupper<-confint(reg1gbl)[2,2]

gbleconb<-summary(reg1gbl)$coef[3,1]
gbleconlower<-confint(reg1gbl)[3,1]
gbleconupper<-confint(reg1gbl)[3,2]

gblintb<-summary(reg2gbl)$coef[4,1]
gblintlower<-confint(reg2gbl)[4,1]
gblintupper<-confint(reg2gbl)[4,2]


gbl$cultrightplussd<-with(gbl, cultright-(mean(cultright, na.rm=T)+sd(cultright, na.rm=T)))

gbl$cultrightminussd<-with(gbl, cultright-(mean(cultright, na.rm=T)-sd(cultright, na.rm=T)))

gbl$econleftplussd<-with(gbl, econleft-(mean(econleft, na.rm=T)+sd(econleft, na.rm=T)))

gbl$econleftminussd<-with(gbl, econleft-(mean(econleft, na.rm=T)-sd(econleft, na.rm=T)))


gblregright<- with(gbl,lm(authgov3i~cultrightplussd+econleftminussd+cultrightplussd:econleftminussd, weights = S017))

gblregleft<- with(gbl,lm(authgov3i~cultrightminussd+econleftplussd+cultrightminussd:econleftplussd, weights = S017))

gblregprot<- with(gbl,lm(authgov3i~cultrightplussd+econleftplussd+cultrightplussd:econleftplussd, weights = S017))

gblregfree<- with(gbl,lm(authgov3i~cultrightminussd+econleftminussd+cultrightminussd:econleftminussd, weights = S017))


gblrightest<-summary(gblregright)$coef[1,1]
gblrightlower<-confint(gblregright)[1,1]
gblrightupper<-confint(gblregright)[1,2]

gblleftest<-summary(gblregleft)$coef[1,1]
gblleftlower<-confint(gblregleft)[1,1]
gblleftupper<-confint(gblregleft)[1,2]

gblprotest<-summary(gblregprot)$coef[1,1]
gblprotlower<-confint(gblregprot)[1,1]
gblprotupper<-confint(gblregprot)[1,2]

gblfreeest<-summary(gblregfree)$coef[1,1]
gblfreelower<-confint(gblregfree)[1,1]
gblfreeupper<-confint(gblregfree)[1,2]


#Italy

ital<-subset(west, subset=(country=='Italy'), select=c(cultright, econleft, authgov3i, S017))


ital$cultrightscl<-with (ital, (cultright-mean(cultright, na.rm=T))/(2*sd(cultright, na.rm=T)))

ital$econleftscl<-with (ital, (econleft-mean(econleft, na.rm=T))/(2*sd(econleft, na.rm=T)))

reg1ital<-lm(authgov3i~cultrightscl+econleftscl, weights=S017, data=ital)

reg2ital<-lm(authgov3i~cultrightscl+econleftscl+cultrightscl:econleftscl, weights=S017, data=ital)


italcultb<-summary(reg1ital)$coef[2,1]
italcultlower<-confint(reg1ital)[2,1]
italcultupper<-confint(reg1ital)[2,2]

italeconb<-summary(reg1ital)$coef[3,1]
italeconlower<-confint(reg1ital)[3,1]
italeconupper<-confint(reg1ital)[3,2]

italintb<-summary(reg2ital)$coef[4,1]
italintlower<-confint(reg2ital)[4,1]
italintupper<-confint(reg2ital)[4,2]


ital$cultrightplussd<-with(ital, cultright-(mean(cultright, na.rm=T)+sd(cultright, na.rm=T)))

ital$cultrightminussd<-with(ital, cultright-(mean(cultright, na.rm=T)-sd(cultright, na.rm=T)))

ital$econleftplussd<-with(ital, econleft-(mean(econleft, na.rm=T)+sd(econleft, na.rm=T)))

ital$econleftminussd<-with(ital, econleft-(mean(econleft, na.rm=T)-sd(econleft, na.rm=T)))


italregright<- with(ital,lm(authgov3i~cultrightplussd+econleftminussd+cultrightplussd:econleftminussd, weights = S017))

italregleft<- with(ital,lm(authgov3i~cultrightminussd+econleftplussd+cultrightminussd:econleftplussd, weights = S017))

italregprot<- with(ital,lm(authgov3i~cultrightplussd+econleftplussd+cultrightplussd:econleftplussd, weights = S017))

italregfree<- with(ital,lm(authgov3i~cultrightminussd+econleftminussd+cultrightminussd:econleftminussd, weights = S017))


italrightest<-summary(italregright)$coef[1,1]
italrightlower<-confint(italregright)[1,1]
italrightupper<-confint(italregright)[1,2]

italleftest<-summary(italregleft)$coef[1,1]
italleftlower<-confint(italregleft)[1,1]
italleftupper<-confint(italregleft)[1,2]

italprotest<-summary(italregprot)$coef[1,1]
italprotlower<-confint(italregprot)[1,1]
italprotupper<-confint(italregprot)[1,2]

italfreeest<-summary(italregfree)$coef[1,1]
italfreelower<-confint(italregfree)[1,1]
italfreeupper<-confint(italregfree)[1,2]

#Netherlands

nthl<-subset(west, subset=(country=='Netherlands'), select=c(cultright, econleft, authgov3i, S017))


nthl$cultrightscl<-with (nthl, (cultright-mean(cultright, na.rm=T))/(2*sd(cultright, na.rm=T)))

nthl$econleftscl<-with (nthl, (econleft-mean(econleft, na.rm=T))/(2*sd(econleft, na.rm=T)))

reg1nthl<-lm(authgov3i~cultrightscl+econleftscl, weights=S017, data=nthl)

reg2nthl<-lm(authgov3i~cultrightscl+econleftscl+cultrightscl:econleftscl, weights=S017, data=nthl)


nthlcultb<-summary(reg1nthl)$coef[2,1]
nthlcultlower<-confint(reg1nthl)[2,1]
nthlcultupper<-confint(reg1nthl)[2,2]

nthleconb<-summary(reg1nthl)$coef[3,1]
nthleconlower<-confint(reg1nthl)[3,1]
nthleconupper<-confint(reg1nthl)[3,2]

nthlintb<-summary(reg2nthl)$coef[4,1]
nthlintlower<-confint(reg2nthl)[4,1]
nthlintupper<-confint(reg2nthl)[4,2]


nthl$cultrightplussd<-with(nthl, cultright-(mean(cultright, na.rm=T)+sd(cultright, na.rm=T)))

nthl$cultrightminussd<-with(nthl, cultright-(mean(cultright, na.rm=T)-sd(cultright, na.rm=T)))

nthl$econleftplussd<-with(nthl, econleft-(mean(econleft, na.rm=T)+sd(econleft, na.rm=T)))

nthl$econleftminussd<-with(nthl, econleft-(mean(econleft, na.rm=T)-sd(econleft, na.rm=T)))


nthlregright<- with(nthl,lm(authgov3i~cultrightplussd+econleftminussd+cultrightplussd:econleftminussd, weights = S017))

nthlregleft<- with(nthl,lm(authgov3i~cultrightminussd+econleftplussd+cultrightminussd:econleftplussd, weights = S017))

nthlregprot<- with(nthl,lm(authgov3i~cultrightplussd+econleftplussd+cultrightplussd:econleftplussd, weights = S017))

nthlregfree<- with(nthl,lm(authgov3i~cultrightminussd+econleftminussd+cultrightminussd:econleftminussd, weights = S017))


nthlrightest<-summary(nthlregright)$coef[1,1]
nthlrightlower<-confint(nthlregright)[1,1]
nthlrightupper<-confint(nthlregright)[1,2]

nthlleftest<-summary(nthlregleft)$coef[1,1]
nthlleftlower<-confint(nthlregleft)[1,1]
nthlleftupper<-confint(nthlregleft)[1,2]

nthlprotest<-summary(nthlregprot)$coef[1,1]
nthlprotlower<-confint(nthlregprot)[1,1]
nthlprotupper<-confint(nthlregprot)[1,2]

nthlfreeest<-summary(nthlregfree)$coef[1,1]
nthlfreelower<-confint(nthlregfree)[1,1]
nthlfreeupper<-confint(nthlregfree)[1,2]

#New Zealand

nzl<-subset(west, subset=(country=='New Zealand'), select=c(cultright, econleft, authgov3i, S017))


nzl$cultrightscl<-with (nzl, (cultright-mean(cultright, na.rm=T))/(2*sd(cultright, na.rm=T)))

nzl$econleftscl<-with (nzl, (econleft-mean(econleft, na.rm=T))/(2*sd(econleft, na.rm=T)))

reg1nzl<-lm(authgov3i~cultrightscl+econleftscl, weights=S017, data=nzl)

reg2nzl<-lm(authgov3i~cultrightscl+econleftscl+cultrightscl:econleftscl, weights=S017, data=nzl)


nzlcultb<-summary(reg1nzl)$coef[2,1]
nzlcultlower<-confint(reg1nzl)[2,1]
nzlcultupper<-confint(reg1nzl)[2,2]

nzleconb<-summary(reg1nzl)$coef[3,1]
nzleconlower<-confint(reg1nzl)[3,1]
nzleconupper<-confint(reg1nzl)[3,2]

nzlintb<-summary(reg2nzl)$coef[4,1]
nzlintlower<-confint(reg2nzl)[4,1]
nzlintupper<-confint(reg2nzl)[4,2]


nzl$cultrightplussd<-with(nzl, cultright-(mean(cultright, na.rm=T)+sd(cultright, na.rm=T)))

nzl$cultrightminussd<-with(nzl, cultright-(mean(cultright, na.rm=T)-sd(cultright, na.rm=T)))

nzl$econleftplussd<-with(nzl, econleft-(mean(econleft, na.rm=T)+sd(econleft, na.rm=T)))

nzl$econleftminussd<-with(nzl, econleft-(mean(econleft, na.rm=T)-sd(econleft, na.rm=T)))


nzlregright<- with(nzl,lm(authgov3i~cultrightplussd+econleftminussd+cultrightplussd:econleftminussd, weights = S017))

nzlregleft<- with(nzl,lm(authgov3i~cultrightminussd+econleftplussd+cultrightminussd:econleftplussd, weights = S017))

nzlregprot<- with(nzl,lm(authgov3i~cultrightplussd+econleftplussd+cultrightplussd:econleftplussd, weights = S017))

nzlregfree<- with(nzl,lm(authgov3i~cultrightminussd+econleftminussd+cultrightminussd:econleftminussd, weights = S017))


nzlrightest<-summary(nzlregright)$coef[1,1]
nzlrightlower<-confint(nzlregright)[1,1]
nzlrightupper<-confint(nzlregright)[1,2]

nzlleftest<-summary(nzlregleft)$coef[1,1]
nzlleftlower<-confint(nzlregleft)[1,1]
nzlleftupper<-confint(nzlregleft)[1,2]

nzlprotest<-summary(nzlregprot)$coef[1,1]
nzlprotlower<-confint(nzlregprot)[1,1]
nzlprotupper<-confint(nzlregprot)[1,2]

nzlfreeest<-summary(nzlregfree)$coef[1,1]
nzlfreelower<-confint(nzlregfree)[1,1]
nzlfreeupper<-confint(nzlregfree)[1,2]


#Norway

norl<-subset(west, subset=(country=='Norway'), select=c(cultright, econleft, authgov3i, S017))


norl$cultrightscl<-with (norl, (cultright-mean(cultright, na.rm=T))/(2*sd(cultright, na.rm=T)))

norl$econleftscl<-with (norl, (econleft-mean(econleft, na.rm=T))/(2*sd(econleft, na.rm=T)))

reg1norl<-lm(authgov3i~cultrightscl+econleftscl, weights=S017, data=norl)

reg2norl<-lm(authgov3i~cultrightscl+econleftscl+cultrightscl:econleftscl, weights=S017, data=norl)


norlcultb<-summary(reg1norl)$coef[2,1]
norlcultlower<-confint(reg1norl)[2,1]
norlcultupper<-confint(reg1norl)[2,2]

norleconb<-summary(reg1norl)$coef[3,1]
norleconlower<-confint(reg1norl)[3,1]
norleconupper<-confint(reg1norl)[3,2]

norlintb<-summary(reg2norl)$coef[4,1]
norlintlower<-confint(reg2norl)[4,1]
norlintupper<-confint(reg2norl)[4,2]


norl$cultrightplussd<-with(norl, cultright-(mean(cultright, na.rm=T)+sd(cultright, na.rm=T)))

norl$cultrightminussd<-with(norl, cultright-(mean(cultright, na.rm=T)-sd(cultright, na.rm=T)))

norl$econleftplussd<-with(norl, econleft-(mean(econleft, na.rm=T)+sd(econleft, na.rm=T)))

norl$econleftminussd<-with(norl, econleft-(mean(econleft, na.rm=T)-sd(econleft, na.rm=T)))


norlregright<- with(norl,lm(authgov3i~cultrightplussd+econleftminussd+cultrightplussd:econleftminussd, weights = S017))

norlregleft<- with(norl,lm(authgov3i~cultrightminussd+econleftplussd+cultrightminussd:econleftplussd, weights = S017))

norlregprot<- with(norl,lm(authgov3i~cultrightplussd+econleftplussd+cultrightplussd:econleftplussd, weights = S017))

norlregfree<- with(norl,lm(authgov3i~cultrightminussd+econleftminussd+cultrightminussd:econleftminussd, weights = S017))


norlrightest<-summary(norlregright)$coef[1,1]
norlrightlower<-confint(norlregright)[1,1]
norlrightupper<-confint(norlregright)[1,2]

norlleftest<-summary(norlregleft)$coef[1,1]
norlleftlower<-confint(norlregleft)[1,1]
norlleftupper<-confint(norlregleft)[1,2]

norlprotest<-summary(norlregprot)$coef[1,1]
norlprotlower<-confint(norlregprot)[1,1]
norlprotupper<-confint(norlregprot)[1,2]

norlfreeest<-summary(norlregfree)$coef[1,1]
norlfreelower<-confint(norlregfree)[1,1]
norlfreeupper<-confint(norlregfree)[1,2]

#Spain

spnl<-subset(west, subset=(country=='Spain'), select=c(cultright, econleft, authgov3i, S017))


spnl$cultrightscl<-with (spnl, (cultright-mean(cultright, na.rm=T))/(2*sd(cultright, na.rm=T)))

spnl$econleftscl<-with (spnl, (econleft-mean(econleft, na.rm=T))/(2*sd(econleft, na.rm=T)))

reg1spnl<-lm(authgov3i~cultrightscl+econleftscl, weights=S017, data=spnl)

reg2spnl<-lm(authgov3i~cultrightscl+econleftscl+cultrightscl:econleftscl, weights=S017, data=spnl)


spnlcultb<-summary(reg1spnl)$coef[2,1]
spnlcultlower<-confint(reg1spnl)[2,1]
spnlcultupper<-confint(reg1spnl)[2,2]

spnleconb<-summary(reg1spnl)$coef[3,1]
spnleconlower<-confint(reg1spnl)[3,1]
spnleconupper<-confint(reg1spnl)[3,2]

spnlintb<-summary(reg2spnl)$coef[4,1]
spnlintlower<-confint(reg2spnl)[4,1]
spnlintupper<-confint(reg2spnl)[4,2]


spnl$cultrightplussd<-with(spnl, cultright-(mean(cultright, na.rm=T)+sd(cultright, na.rm=T)))

spnl$cultrightminussd<-with(spnl, cultright-(mean(cultright, na.rm=T)-sd(cultright, na.rm=T)))

spnl$econleftplussd<-with(spnl, econleft-(mean(econleft, na.rm=T)+sd(econleft, na.rm=T)))

spnl$econleftminussd<-with(spnl, econleft-(mean(econleft, na.rm=T)-sd(econleft, na.rm=T)))


spnlregright<- with(spnl,lm(authgov3i~cultrightplussd+econleftminussd+cultrightplussd:econleftminussd, weights = S017))

spnlregleft<- with(spnl,lm(authgov3i~cultrightminussd+econleftplussd+cultrightminussd:econleftplussd, weights = S017))

spnlregprot<- with(spnl,lm(authgov3i~cultrightplussd+econleftplussd+cultrightplussd:econleftplussd, weights = S017))

spnlregfree<- with(spnl,lm(authgov3i~cultrightminussd+econleftminussd+cultrightminussd:econleftminussd, weights = S017))


spnlrightest<-summary(spnlregright)$coef[1,1]
spnlrightlower<-confint(spnlregright)[1,1]
spnlrightupper<-confint(spnlregright)[1,2]

spnlleftest<-summary(spnlregleft)$coef[1,1]
spnlleftlower<-confint(spnlregleft)[1,1]
spnlleftupper<-confint(spnlregleft)[1,2]

spnlprotest<-summary(spnlregprot)$coef[1,1]
spnlprotlower<-confint(spnlregprot)[1,1]
spnlprotupper<-confint(spnlregprot)[1,2]

spnlfreeest<-summary(spnlregfree)$coef[1,1]
spnlfreelower<-confint(spnlregfree)[1,1]
spnlfreeupper<-confint(spnlregfree)[1,2]

#Sweden

swel<-subset(west, subset=(country=='Sweden'), select=c(cultright, econleft, authgov3i, S017))



swel$cultrightscl<-with (swel, (cultright-mean(cultright, na.rm=T))/(2*sd(cultright, na.rm=T)))

swel$econleftscl<-with (swel, (econleft-mean(econleft, na.rm=T))/(2*sd(econleft, na.rm=T)))

reg1swel<-lm(authgov3i~cultrightscl+econleftscl, weights=S017, data=swel)

reg2swel<-lm(authgov3i~cultrightscl+econleftscl+cultrightscl:econleftscl, weights=S017, data=swel)


swelcultb<-summary(reg1swel)$coef[2,1]
swelcultlower<-confint(reg1swel)[2,1]
swelcultupper<-confint(reg1swel)[2,2]

sweleconb<-summary(reg1swel)$coef[3,1]
sweleconlower<-confint(reg1swel)[3,1]
sweleconupper<-confint(reg1swel)[3,2]

swelintb<-summary(reg2swel)$coef[4,1]
swelintlower<-confint(reg2swel)[4,1]
swelintupper<-confint(reg2swel)[4,2]


swel$cultrightplussd<-with(swel, cultright-(mean(cultright, na.rm=T)+sd(cultright, na.rm=T)))

swel$cultrightminussd<-with(swel, cultright-(mean(cultright, na.rm=T)-sd(cultright, na.rm=T)))

swel$econleftplussd<-with(swel, econleft-(mean(econleft, na.rm=T)+sd(econleft, na.rm=T)))

swel$econleftminussd<-with(swel, econleft-(mean(econleft, na.rm=T)-sd(econleft, na.rm=T)))


swelregright<- with(swel,lm(authgov3i~cultrightplussd+econleftminussd+cultrightplussd:econleftminussd, weights = S017))

swelregleft<- with(swel,lm(authgov3i~cultrightminussd+econleftplussd+cultrightminussd:econleftplussd, weights = S017))

swelregprot<- with(swel,lm(authgov3i~cultrightplussd+econleftplussd+cultrightplussd:econleftplussd, weights = S017))

swelregfree<- with(swel,lm(authgov3i~cultrightminussd+econleftminussd+cultrightminussd:econleftminussd, weights = S017))


swelrightest<-summary(swelregright)$coef[1,1]
swelrightlower<-confint(swelregright)[1,1]
swelrightupper<-confint(swelregright)[1,2]

swelleftest<-summary(swelregleft)$coef[1,1]
swelleftlower<-confint(swelregleft)[1,1]
swelleftupper<-confint(swelregleft)[1,2]

swelprotest<-summary(swelregprot)$coef[1,1]
swelprotlower<-confint(swelregprot)[1,1]
swelprotupper<-confint(swelregprot)[1,2]

swelfreeest<-summary(swelregfree)$coef[1,1]
swelfreelower<-confint(swelregfree)[1,1]
swelfreeupper<-confint(swelregfree)[1,2]

#Switzerland

swil<-subset(west, subset=(country=='Switzerland'), select=c(cultright, econleft, authgov3i, S017))


swil$cultrightscl<-with (swil, (cultright-mean(cultright, na.rm=T))/(2*sd(cultright, na.rm=T)))

swil$econleftscl<-with (swil, (econleft-mean(econleft, na.rm=T))/(2*sd(econleft, na.rm=T)))

reg1swil<-lm(authgov3i~cultrightscl+econleftscl, weights=S017, data=swil)

reg2swil<-lm(authgov3i~cultrightscl+econleftscl+cultrightscl:econleftscl, weights=S017, data=swil)


swilcultb<-summary(reg1swil)$coef[2,1]
swilcultlower<-confint(reg1swil)[2,1]
swilcultupper<-confint(reg1swil)[2,2]

swileconb<-summary(reg1swil)$coef[3,1]
swileconlower<-confint(reg1swil)[3,1]
swileconupper<-confint(reg1swil)[3,2]

swilintb<-summary(reg2swil)$coef[4,1]
swilintlower<-confint(reg2swil)[4,1]
swilintupper<-confint(reg2swil)[4,2]


swil$cultrightplussd<-with(swil, cultright-(mean(cultright, na.rm=T)+sd(cultright, na.rm=T)))

swil$cultrightminussd<-with(swil, cultright-(mean(cultright, na.rm=T)-sd(cultright, na.rm=T)))

swil$econleftplussd<-with(swil, econleft-(mean(econleft, na.rm=T)+sd(econleft, na.rm=T)))

swil$econleftminussd<-with(swil, econleft-(mean(econleft, na.rm=T)-sd(econleft, na.rm=T)))


swilregright<- with(swil,lm(authgov3i~cultrightplussd+econleftminussd+cultrightplussd:econleftminussd, weights = S017))

swilregleft<- with(swil,lm(authgov3i~cultrightminussd+econleftplussd+cultrightminussd:econleftplussd, weights = S017))

swilregprot<- with(swil,lm(authgov3i~cultrightplussd+econleftplussd+cultrightplussd:econleftplussd, weights = S017))

swilregfree<- with(swil,lm(authgov3i~cultrightminussd+econleftminussd+cultrightminussd:econleftminussd, weights = S017))


swilrightest<-summary(swilregright)$coef[1,1]
swilrightlower<-confint(swilregright)[1,1]
swilrightupper<-confint(swilregright)[1,2]

swilleftest<-summary(swilregleft)$coef[1,1]
swilleftlower<-confint(swilregleft)[1,1]
swilleftupper<-confint(swilregleft)[1,2]

swilprotest<-summary(swilregprot)$coef[1,1]
swilprotlower<-confint(swilregprot)[1,1]
swilprotupper<-confint(swilregprot)[1,2]

swilfreeest<-summary(swilregfree)$coef[1,1]
swilfreelower<-confint(swilregfree)[1,1]
swilfreeupper<-confint(swilregfree)[1,2]


#United States

usl<-subset(west, subset=(country=='United States'), select=c(cultright, econleft, authgov3i, S017))



usl$cultrightscl<-with (usl, (cultright-mean(cultright, na.rm=T))/(2*sd(cultright, na.rm=T)))

usl$econleftscl<-with (usl, (econleft-mean(econleft, na.rm=T))/(2*sd(econleft, na.rm=T)))

reg1usl<-lm(authgov3i~cultrightscl+econleftscl, weights=S017, data=usl)

reg2usl<-lm(authgov3i~cultrightscl+econleftscl+cultrightscl:econleftscl, weights=S017, data=usl)


uslcultb<-summary(reg1usl)$coef[2,1]
uslcultlower<-confint(reg1usl)[2,1]
uslcultupper<-confint(reg1usl)[2,2]

usleconb<-summary(reg1usl)$coef[3,1]
usleconlower<-confint(reg1usl)[3,1]
usleconupper<-confint(reg1usl)[3,2]

uslintb<-summary(reg2usl)$coef[4,1]
uslintlower<-confint(reg2usl)[4,1]
uslintupper<-confint(reg2usl)[4,2]


usl$cultrightplussd<-with(usl, cultright-(mean(cultright, na.rm=T)+sd(cultright, na.rm=T)))

usl$cultrightminussd<-with(usl, cultright-(mean(cultright, na.rm=T)-sd(cultright, na.rm=T)))

usl$econleftplussd<-with(usl, econleft-(mean(econleft, na.rm=T)+sd(econleft, na.rm=T)))

usl$econleftminussd<-with(usl, econleft-(mean(econleft, na.rm=T)-sd(econleft, na.rm=T)))


uslregright<- with(usl,lm(authgov3i~cultrightplussd+econleftminussd+cultrightplussd:econleftminussd, weights = S017))

uslregleft<- with(usl,lm(authgov3i~cultrightminussd+econleftplussd+cultrightminussd:econleftplussd, weights = S017))

uslregprot<- with(usl,lm(authgov3i~cultrightplussd+econleftplussd+cultrightplussd:econleftplussd, weights = S017))

uslregfree<- with(usl,lm(authgov3i~cultrightminussd+econleftminussd+cultrightminussd:econleftminussd, weights = S017))


uslrightest<-summary(uslregright)$coef[1,1]
uslrightlower<-confint(uslregright)[1,1]
uslrightupper<-confint(uslregright)[1,2]

uslleftest<-summary(uslregleft)$coef[1,1]
uslleftlower<-confint(uslregleft)[1,1]
uslleftupper<-confint(uslregleft)[1,2]

uslprotest<-summary(uslregprot)$coef[1,1]
uslprotlower<-confint(uslregprot)[1,1]
uslprotupper<-confint(uslregprot)[1,2]

uslfreeest<-summary(uslregfree)$coef[1,1]
uslfreelower<-confint(uslregfree)[1,1]
uslfreeupper<-confint(uslregfree)[1,2]

